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

git_access_design.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 36604bd0b3bed7010a24cc6ec54bb6efa8308eee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Gitlab
  class GitAccessDesign < GitAccess
    def check(_cmd, _changes)
      check_protocol!
      check_can_create_design!

      success_result
    end

    private

    def check_protocol!
      if protocol != 'web'
        raise ::Gitlab::GitAccess::ForbiddenError, "Designs are only accessible using the web interface"
      end
    end

    def check_can_create_design!
      unless user&.can?(:create_design, project)
        raise ::Gitlab::GitAccess::ForbiddenError, "You are not allowed to manage designs of this project"
      end
    end
  end
end

Gitlab::GitAccessDesign.prepend_if_ee('EE::Gitlab::GitAccessDesign')