Commit c5bdb212 authored by Pavel Shutsin's avatar Pavel Shutsin

Move out link\unlink ability checks to a policy

We can extend the policy in EE for additional behavior
parent 22f792f7
...@@ -13,3 +13,5 @@ class IdentityProviderPolicy < BasePolicy ...@@ -13,3 +13,5 @@ class IdentityProviderPolicy < BasePolicy
rule { protected_provider }.prevent(:unlink) rule { protected_provider }.prevent(:unlink)
end end
IdentityProviderPolicy.prepend(EE::IdentityProviderPolicy)
...@@ -3,5 +3,9 @@ ...@@ -3,5 +3,9 @@
.provider-btn-group .provider-btn-group
.provider-btn-image .provider-btn-image
= _("SAML for %{group_name}") % { group_name: group.name } = _("SAML for %{group_name}") % { group_name: group.name }
= link_to unlink_group_saml_providers_path(group), method: :delete, class: 'provider-btn' do - if unlink_provider_allowed?(identity.saml_provider)
Disconnect = link_to unlink_group_saml_providers_path(group), method: :delete, class: 'provider-btn' do
= s_('Profiles|Disconnect')
- else
%a.provider-btn
= s_('Profiles|Active')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment