debian-mirror-gitlab/app/controllers/concerns/project_unauthorized.rb

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

22 lines
680 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
module ProjectUnauthorized
2019-09-04 21:01:54 +05:30
module ControllerActions
def self.on_routable_not_found
2021-11-11 11:23:49 +05:30
lambda do |routable, full_path|
2019-09-04 21:01:54 +05:30
return unless routable.is_a?(Project)
label = routable.external_authorization_classification_label
2019-07-07 11:18:12 +05:30
rejection_reason = nil
unless ::Gitlab::ExternalAuthorization.access_allowed?(current_user, label)
rejection_reason = ::Gitlab::ExternalAuthorization.rejection_reason(current_user, label)
rejection_reason ||= _('External authorization denied access to this project')
end
2019-09-04 21:01:54 +05:30
access_denied!(rejection_reason) if rejection_reason
2019-07-07 11:18:12 +05:30
end
end
2018-12-13 13:39:08 +05:30
end
end