debian-mirror-gitlab/app/policies/identity_provider_policy.rb
2023-07-09 08:55:56 +05:30

17 lines
412 B
Ruby

# frozen_string_literal: true
class IdentityProviderPolicy < BasePolicy
desc "Provider is SAML"
condition(:protected_provider, scope: :subject, score: 0) { @subject.to_s == 'saml' }
rule { anonymous }.prevent_all
rule { default }.policy do
enable :unlink
enable :link
end
rule { protected_provider }.prevent(:unlink)
end
IdentityProviderPolicy.prepend_mod_with('IdentityProviderPolicy')