2019-03-18 10:36:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class IdentityProviderPolicy < BasePolicy
|
|
|
|
desc "Provider is SAML or CAS3"
|
|
|
|
condition(:protected_provider, scope: :subject, score: 0) { %w(saml cas3).include?(@subject.to_s) }
|
|
|
|
|
|
|
|
rule { anonymous }.prevent_all
|
|
|
|
|
|
|
|
rule { default }.policy do
|
|
|
|
enable :unlink
|
|
|
|
enable :link
|
|
|
|
end
|
|
|
|
|
|
|
|
rule { protected_provider }.prevent(:unlink)
|
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
IdentityProviderPolicy.prepend_if_ee('EE::IdentityProviderPolicy')
|