Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Shutsin <pshutsin@gitlab.com>2019-03-18 17:36:34 +0300
committerPavel Shutsin <pshutsin@gitlab.com>2019-03-19 15:38:16 +0300
commit8ee1927db90d43205b4e6f8bd13f209c74b41bd1 (patch)
tree247e5f813947c1bdeb838e2776835208e6a7e2bc /app/helpers
parenta4b18040778d7272bd8fbbb3746e199699ffd893 (diff)
Move out link\unlink ability checks to a policy
We can extend the policy in EE for additional behavior
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/auth_helper.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb
index 2b1d6f49878..b4ee648361c 100644
--- a/app/helpers/auth_helper.rb
+++ b/app/helpers/auth_helper.rb
@@ -100,8 +100,12 @@ module AuthHelper
end
# rubocop: enable CodeReuse/ActiveRecord
- def unlink_allowed?(provider)
- %w(saml cas3).exclude?(provider.to_s)
+ def unlink_provider_allowed?(provider)
+ IdentityProviderPolicy.new(current_user, provider).can?(:unlink)
+ end
+
+ def link_provider_allowed?(provider)
+ IdentityProviderPolicy.new(current_user, provider).can?(:link)
end
extend self