2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class IdentityProviderPolicy < BasePolicy
|
2023-07-09 08:55:56 +05:30
|
|
|
desc "Provider is SAML"
|
|
|
|
condition(:protected_provider, scope: :subject, score: 0) { @subject.to_s == 'saml' }
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
rule { anonymous }.prevent_all
|
|
|
|
|
|
|
|
rule { default }.policy do
|
|
|
|
enable :unlink
|
|
|
|
enable :link
|
|
|
|
end
|
|
|
|
|
|
|
|
rule { protected_provider }.prevent(:unlink)
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
IdentityProviderPolicy.prepend_mod_with('IdentityProviderPolicy')
|