Commit e9a9f702 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'if-10137-ee_specific_lines_protected_branches_api' into 'master'

Move EE specific lines in API::ProtectedBranches

See merge request gitlab-org/gitlab-ee!13297
parents ebb6408b ea1d85d0
# frozen_string_literal: true
module EE
module API
module Helpers
module ProtectedBranchesHelpers
extend ActiveSupport::Concern
prepended do
params :optional_params_ee do
optional :unprotect_access_level, type: Integer,
values: ::ProtectedBranch::UnprotectAccessLevel.allowed_access_levels,
desc: 'Access levels allowed to unprotect (defaults: `40`, maintainer access level)'
optional :allowed_to_push, type: Array, desc: 'An array of users/groups allowed to push' do
optional :access_level, type: Integer, values: ::ProtectedBranch::PushAccessLevel.allowed_access_levels
optional :user_id, type: Integer
optional :group_id, type: Integer
end
optional :allowed_to_merge, type: Array, desc: 'An array of users/groups allowed to merge' do
optional :access_level, type: Integer, values: ::ProtectedBranch::MergeAccessLevel.allowed_access_levels
optional :user_id, type: Integer
optional :group_id, type: Integer
end
optional :allowed_to_unprotect, type: Array, desc: 'An array of users/groups allowed to unprotect' do
optional :access_level, type: Integer, values: ::ProtectedBranch::UnprotectAccessLevel.allowed_access_levels
optional :user_id, type: Integer
optional :group_id, type: Integer
end
end
end
end
end
end
end
# frozen_string_literal: true
module API
module Helpers
module ProtectedBranchesHelpers
extend ActiveSupport::Concern
extend Grape::API::Helpers
params :optional_params_ee do
end
end
end
end
API::Helpers::ProtectedBranchesHelpers.prepend(EE::API::Helpers::ProtectedBranchesHelpers)
......@@ -8,6 +8,8 @@ module API
before { authorize_admin_project }
helpers Helpers::ProtectedBranchesHelpers
params do
requires :id, type: String, desc: 'The ID of a project'
end
......@@ -52,29 +54,7 @@ module API
values: ProtectedBranch::MergeAccessLevel.allowed_access_levels,
desc: 'Access levels allowed to merge (defaults: `40`, maintainer access level)'
if Gitlab.ee?
optional :unprotect_access_level, type: Integer,
values: ProtectedBranch::UnprotectAccessLevel.allowed_access_levels,
desc: 'Access levels allowed to unprotect (defaults: `40`, maintainer access level)'
optional :allowed_to_push, type: Array, desc: 'An array of users/groups allowed to push' do
optional :access_level, type: Integer, values: ProtectedBranch::PushAccessLevel.allowed_access_levels
optional :user_id, type: Integer
optional :group_id, type: Integer
end
optional :allowed_to_merge, type: Array, desc: 'An array of users/groups allowed to merge' do
optional :access_level, type: Integer, values: ProtectedBranch::MergeAccessLevel.allowed_access_levels
optional :user_id, type: Integer
optional :group_id, type: Integer
end
optional :allowed_to_unprotect, type: Array, desc: 'An array of users/groups allowed to unprotect' do
optional :access_level, type: Integer, values: ProtectedBranch::UnprotectAccessLevel.allowed_access_levels
optional :user_id, type: Integer
optional :group_id, type: Integer
end
end
use :optional_params_ee
end
# rubocop: disable CodeReuse/ActiveRecord
post ':id/protected_branches' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment