Backport changes to API::ProtectedBranches

This backports EE specific parameters EE adds to API::ProtectedBranches,
and wraps them in a conditional.
This commit is contained in:
Yorick Peterse 2019-03-22 16:35:54 +01:00
parent be49d9c1ba
commit 05534daa1c
No known key found for this signature in database
GPG Key ID: EDD30D2BEB691AC9
1 changed files with 24 additions and 0 deletions

View File

@ -51,6 +51,30 @@ module API
optional :merge_access_level, type: Integer,
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
end
# rubocop: disable CodeReuse/ActiveRecord
post ':id/protected_branches' do