Welcome to mirror list, hosted at ThFree Co, Russian Federation.

update_service.rb « protected_branches « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 58f2f774baeddf6b3c5c4527b97a5d1ae7304e45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module ProtectedBranches
  class UpdateService < ProtectedBranches::BaseService
    attr_reader :protected_branch

    def initialize(project, current_user, id, params = {})
      super(project, current_user, params)
      @protected_branch = ProtectedBranch.find(id)
    end

    def execute
      raise Gitlab::Access::AccessDeniedError unless current_user.can?(:admin_project, project)

      ProtectedBranch.transaction do
        set_access_levels!
      end

      true
    rescue ActiveRecord::RecordInvalid
      false
    end
  end
end