diff options
author | Rémy Coutable <remy@rymai.me> | 2016-11-24 13:22:38 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-11-24 13:22:38 +0100 |
commit | 304163becba3610a99dfff644c13972a2f54ed3b (patch) | |
tree | 643be0d2dcddadf16d3996a28617203939cbb480 /lib/api | |
parent | 4d2e7894efa36cc1b5de9432e25fcf22b6cf1d59 (diff) | |
download | gitlab-ce-304163becba3610a99dfff644c13972a2f54ed3b.tar.gz |
API: Use `#find_project` in API::Triggers and API::Services
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/services.rb | 2 | ||||
-rw-r--r-- | lib/api/triggers.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/services.rb b/lib/api/services.rb index 4d23499aa39..bc427705777 100644 --- a/lib/api/services.rb +++ b/lib/api/services.rb @@ -65,7 +65,7 @@ module API detail 'Added in GitLab 8.13' end post ':id/services/:service_slug/trigger' do - project = Project.find_with_namespace(params[:id]) || Project.find_by(id: params[:id]) + project = find_project(params[:id]) # This is not accurate, but done to prevent leakage of the project names not_found!('Service') unless project diff --git a/lib/api/triggers.rb b/lib/api/triggers.rb index 569598fbd2c..bb4de39def1 100644 --- a/lib/api/triggers.rb +++ b/lib/api/triggers.rb @@ -13,7 +13,7 @@ module API optional :variables, type: Hash, desc: 'The list of variables to be injected into build' end post ":id/(ref/:ref/)trigger/builds" do - project = Project.find_with_namespace(params[:id]) || Project.find_by(id: params[:id]) + project = find_project(params[:id]) trigger = Ci::Trigger.find_by_token(params[:token].to_s) not_found! unless project && trigger unauthorized! unless trigger.project == project |