summaryrefslogtreecommitdiff
path: root/app/controllers/groups/dependency_proxies_controller.rb
blob: 2e120de435ee7c3b50848612809676649fbd7774 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Groups
  class DependencyProxiesController < Groups::ApplicationController
    include ::DependencyProxy::GroupAccess

    before_action :authorize_admin_dependency_proxy!, only: :update
    before_action :verify_dependency_proxy_enabled!

    feature_category :package_registry

    private

    def dependency_proxy
      @dependency_proxy ||=
        group.dependency_proxy_setting || group.create_dependency_proxy_setting!
    end

    def verify_dependency_proxy_enabled!
      render_404 unless dependency_proxy.enabled?
    end
  end
end