summaryrefslogtreecommitdiff
path: root/app/services/protected_branches/base_service.rb
blob: 3a7c35327fef896ff051c7296729dfea8a2e808e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module ProtectedBranches
  class BaseService < ::BaseService
    def set_access_levels!
      case params[:allowed_to_merge]
      when 'masters'
        @protected_branch.merge_access_level.masters!
      when 'developers'
        @protected_branch.merge_access_level.developers!
      end

      case params[:allowed_to_push]
      when 'masters'
        @protected_branch.push_access_level.masters!
      when 'developers'
        @protected_branch.push_access_level.developers!
      when 'no_one'
        @protected_branch.push_access_level.no_one!
      end
    end
  end
end