gitlab-org--gitlab-foss/app/services/protected_branches/api_service.rb
James Edwards-Jones 1d47ae1365 CE backport of ProtectedBranches API changes
In EE we now allow individual users/groups to be set on POST, which required some refactoring.
See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/3516
2017-12-07 11:58:50 +00:00

24 lines
603 B
Ruby

module ProtectedBranches
class ApiService < BaseService
def create
@push_params = AccessLevelParams.new(:push, params)
@merge_params = AccessLevelParams.new(:merge, params)
verify_params!
protected_branch_params = {
name: params[:name],
push_access_levels_attributes: @push_params.access_levels,
merge_access_levels_attributes: @merge_params.access_levels
}
::ProtectedBranches::CreateService.new(@project, @current_user, protected_branch_params).execute
end
private
def verify_params!
# EE-only
end
end
end