2020-10-24 23:57:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PackagesAccess
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
before_action :verify_packages_enabled!
|
|
|
|
before_action :verify_read_package!
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def verify_packages_enabled!
|
|
|
|
render_404 unless Gitlab.config.packages.enabled
|
|
|
|
end
|
|
|
|
|
|
|
|
def verify_read_package!
|
2022-10-11 01:57:18 +05:30
|
|
|
access_denied! unless can?(current_user, :read_package, project&.packages_policy_subject)
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
|
|
|
end
|