Skip to content

Cloud accounts list route block parameter checking #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lifeBCE opened this issue Jul 2, 2014 · 0 comments
Open

Cloud accounts list route block parameter checking #24

lifeBCE opened this issue Jul 2, 2014 · 0 comments

Comments

@lifeBCE
Copy link

lifeBCE commented Jul 2, 2014

The route block that handles listing all cloud accounts has a logic issue. It attempt to do some input parameter validation and supposed to return an error condition if required params are not found but this logic falls through to happy path logic every time because there is no use of 'halt'.

if params[:org_id].nil?
  message = Error.new.extend(ErrorRepresenter)
  message.message = "Must provide org_id with request for cloud accounts."
  [BAD_REQUEST, message.to_json]
elsif params[:account_id].nil?
  message = Error.new.extend(ErrorRepresenter)
  message.message = "Must provide account_id with request for cloud accounts."
  [BAD_REQUEST, message.to_json]
end

In a few other route blocks in this class, a return call is used in this case instead of a halt. All should be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant