Skip to content

Commit

Permalink
Move constants to the top of the class
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Dec 20, 2023
1 parent 471d39a commit 7bccca7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/api/app/controllers/source_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
class SourceController < ApplicationController
include Source::Errors

SOURCE_UNTOUCHED_COMMANDS = ['branch', 'diff', 'linkdiff', 'servicediff', 'showlinked', 'rebuild', 'wipe',
'waitservice', 'remove_flag', 'set_flag', 'getprojectservices'].freeze
# list of cammands which create the target package
PACKAGE_CREATING_COMMANDS = ['branch', 'release', 'copy', 'undelete', 'instantiate'].freeze
# list of commands which are allowed even when the project has the package only via a project link
READ_COMMANDS = ['branch', 'diff', 'linkdiff', 'servicediff', 'showlinked', 'getprojectservices', 'release'].freeze
# commands which are fine to operate on external scm managed projects
SCM_SYNC_PROJECT_COMMANDS = ['diff', 'linkdiff', 'showlinked', 'copy', 'remove_flag', 'set_flag', 'runservice',
'waitservice', 'getprojectservices', 'unlock', 'wipe', 'rebuild', 'collectbuildenv'].freeze

validate_action index: { method: :get, response: :directory }
validate_action projectlist: { method: :get, response: :directory }
validate_action packagelist: { method: :get, response: :directory }
Expand Down Expand Up @@ -197,16 +207,6 @@ def package_command
dispatch_command(:package_command, @command)
end

SOURCE_UNTOUCHED_COMMANDS = ['branch', 'diff', 'linkdiff', 'servicediff', 'showlinked', 'rebuild', 'wipe',
'waitservice', 'remove_flag', 'set_flag', 'getprojectservices'].freeze
# list of cammands which create the target package
PACKAGE_CREATING_COMMANDS = ['branch', 'release', 'copy', 'undelete', 'instantiate'].freeze
# list of commands which are allowed even when the project has the package only via a project link
READ_COMMANDS = ['branch', 'diff', 'linkdiff', 'servicediff', 'showlinked', 'getprojectservices', 'release'].freeze
# commands which are fine to operate on external scm managed projects
SCM_SYNC_PROJECT_COMMANDS = ['diff', 'linkdiff', 'showlinked', 'copy', 'remove_flag', 'set_flag', 'runservice',
'waitservice', 'getprojectservices', 'unlock', 'wipe', 'rebuild', 'collectbuildenv'].freeze

def validate_target_for_package_command_exists!
@project = nil
@package = nil
Expand Down

0 comments on commit 7bccca7

Please sign in to comment.