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

group_access.rb « dependency_proxy « concerns « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2a923d02752331cccc3e6a93621f6c7e898d3a06 (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
# frozen_string_literal: true

module DependencyProxy
  module GroupAccess
    extend ActiveSupport::Concern

    included do
      before_action :verify_dependency_proxy_enabled!
      before_action :authorize_read_dependency_proxy!
    end

    private

    def verify_dependency_proxy_enabled!
      render_404 unless group.dependency_proxy_feature_available?
    end

    def authorize_read_dependency_proxy!
      access_denied! unless can?(current_user, :read_dependency_proxy, group)
    end

    def authorize_admin_dependency_proxy!
      access_denied! unless can?(current_user, :admin_dependency_proxy, group)
    end
  end
end