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

22 lines
627 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
module ProjectUnauthorized
2019-05-30 16:15:17 +05:30
def project_unauthorized_proc
2019-07-07 11:18:12 +05:30
lambda do |project|
if project
label = project.external_authorization_classification_label
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
if rejection_reason
access_denied!(rejection_reason)
end
end
end
2018-12-13 13:39:08 +05:30
end
end