diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-09-06 12:20:12 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-09-06 12:20:12 +0300 |
commit | 80b3dcc777c72ee1853b4228baf6310ccd5e44d8 (patch) | |
tree | e0adc2e6d8ebcca785df28438b30a37566f595a5 /lib/api/helpers.rb | |
parent | d4154ef30f52b30054e8e5d9bbf172d8700e8049 (diff) |
Extract job artifacts API code to a separate file
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index f9ce1165544..6fa1527461f 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -128,6 +128,10 @@ module API merge_request end + def find_build!(id) + user_project.builds.find(id.to_i) + end + def authenticate! unauthorized! unless current_user && can?(initial_current_user, :access_api) end @@ -160,6 +164,14 @@ module API authorize! :admin_project, user_project end + def authorize_read_builds! + authorize! :read_build, user_project + end + + def authorize_update_builds! + authorize! :update_build, user_project + end + def require_gitlab_workhorse! unless env['HTTP_GITLAB_WORKHORSE'].present? forbidden!('Request should be executed via GitLab Workhorse') |