Skip to content

Commit

Permalink
Merge pull request #5807 from dmarcoux/use-required_parameters
Browse files Browse the repository at this point in the history
Use required_parameters to check presence of cmd
  • Loading branch information
Dany Marcoux committed Sep 7, 2018
2 parents 6a47fb3 + 4d00eba commit f12cbec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/api/app/controllers/source_project_controller.rb
Expand Up @@ -85,14 +85,12 @@ def delete
def project_command
# init and validation
#--------------------
required_parameters(:cmd)

valid_commands = ['undelete', 'showlinked', 'remove_flag', 'set_flag', 'createpatchinfo',
'createkey', 'extendkey', 'copy', 'createmaintenanceincident', 'lock',
'unlock', 'release', 'addchannels', 'modifychannels', 'move', 'freezelink']

unless params.key?(:cmd)
raise IllegalRequest, 'missing_command'
end

unless valid_commands.include?(params[:cmd])
raise IllegalRequest, 'invalid_command'
end
Expand Down

0 comments on commit f12cbec

Please sign in to comment.