debian-mirror-gitlab/app/services/protected_branches/api_service.rb

19 lines
551 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
module ProtectedBranches
class ApiService < BaseService
def create
2019-05-30 16:15:17 +05:30
@push_params = AccessLevelParams.new(:push, params)
@merge_params = AccessLevelParams.new(:merge, params)
2018-03-17 18:26:18 +05:30
2019-05-30 16:15:17 +05:30
protected_branch_params = {
2018-03-17 18:26:18 +05:30
name: params[:name],
2019-05-30 16:15:17 +05:30
push_access_levels_attributes: @push_params.access_levels,
merge_access_levels_attributes: @merge_params.access_levels
2018-03-17 18:26:18 +05:30
}
2019-05-30 16:15:17 +05:30
::ProtectedBranches::CreateService.new(@project, @current_user, protected_branch_params).execute
2018-03-17 18:26:18 +05:30
end
end
end