diff options
author | Nick Thomas <nick@gitlab.com> | 2019-03-20 16:08:05 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-03-20 16:08:05 +0000 |
commit | 4249eac3058fbc57724feb04b98a547732ca5959 (patch) | |
tree | 64fdca86085444bfb4b9b30760256705e2c84666 /app/views/profiles | |
parent | 9820cdaf8e985c338ecbd4c6659479551a7518f7 (diff) | |
parent | 8ee1927db90d43205b4e6f8bd13f209c74b41bd1 (diff) | |
download | gitlab-ce-4249eac3058fbc57724feb04b98a547732ca5959.tar.gz |
Merge branch 'create-identity-provider-policy' into 'master'
Move out link\unlink ability checks to a policy
See merge request gitlab-org/gitlab-ce!26278
Diffstat (limited to 'app/views/profiles')
-rw-r--r-- | app/views/profiles/accounts/_providers.html.haml | 21 | ||||
-rw-r--r-- | app/views/profiles/accounts/show.html.haml | 19 |
2 files changed, 22 insertions, 18 deletions
diff --git a/app/views/profiles/accounts/_providers.html.haml b/app/views/profiles/accounts/_providers.html.haml new file mode 100644 index 00000000000..068f9cc70f7 --- /dev/null +++ b/app/views/profiles/accounts/_providers.html.haml @@ -0,0 +1,21 @@ +%label.label-bold + = s_('Profiles|Connected Accounts') + %p= s_('Profiles|Click on icon to activate signin with one of the following services') + - providers.each do |provider| + - unlink_allowed = unlink_provider_allowed?(provider) + - link_allowed = link_provider_allowed?(provider) + - if unlink_allowed || link_allowed + .provider-btn-group + .provider-btn-image + = provider_image_tag(provider) + - if auth_active?(provider) + - if unlink_allowed + = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'provider-btn' do + = s_('Profiles|Disconnect') + - else + %a.provider-btn + = s_('Profiles|Active') + - elsif link_allowed + = link_to omniauth_authorize_path(:user, provider), method: :post, class: 'provider-btn not-active' do + = s_('Profiles|Connect') + = render_if_exists 'profiles/accounts/group_saml_unlink_buttons', group_saml_identities: group_saml_identities diff --git a/app/views/profiles/accounts/show.html.haml b/app/views/profiles/accounts/show.html.haml index ee2c5a13b8a..e6380817c8f 100644 --- a/app/views/profiles/accounts/show.html.haml +++ b/app/views/profiles/accounts/show.html.haml @@ -29,24 +29,7 @@ %p = s_('Profiles|Activate signin with one of the following services') .col-lg-8 - %label.label-bold - = s_('Profiles|Connected Accounts') - %p= s_('Profiles|Click on icon to activate signin with one of the following services') - - button_based_providers.each do |provider| - .provider-btn-group - .provider-btn-image - = provider_image_tag(provider) - - if auth_active?(provider) - - if unlink_allowed?(provider) - = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'provider-btn' do - = s_('Profiles|Disconnect') - - else - %a.provider-btn - = s_('Profiles|Active') - - else - = link_to omniauth_authorize_path(:user, provider), method: :post, class: 'provider-btn not-active' do - = s_('Profiles|Connect') - = render_if_exists 'profiles/accounts/group_saml_unlink_buttons', group_saml_identities: local_assigns[:group_saml_identities] + = render 'providers', providers: button_based_providers, group_saml_identities: local_assigns[:group_saml_identities] %hr - if current_user.can_change_username? .row.prepend-top-default |