debian-mirror-gitlab/app/controllers/concerns/dependency_proxy/group_access.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
590 B
Ruby
Raw Normal View History

2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
module DependencyProxy
module GroupAccess
extend ActiveSupport::Concern
included do
2022-01-26 12:08:38 +05:30
before_action :verify_dependency_proxy_available!
2021-02-22 17:27:13 +05:30
before_action :authorize_read_dependency_proxy!
end
private
2022-01-26 12:08:38 +05:30
def verify_dependency_proxy_available!
2021-10-27 15:23:28 +05:30
render_404 unless group&.dependency_proxy_feature_available?
2021-02-22 17:27:13 +05:30
end
def authorize_read_dependency_proxy!
2021-10-27 15:23:28 +05:30
access_denied! unless can?(auth_user, :read_dependency_proxy, group)
2021-02-22 17:27:13 +05:30
end
end
end
2022-10-11 01:57:18 +05:30
DependencyProxy::GroupAccess.prepend_mod_with('DependencyProxy::GroupAccess')