Commit 0e3f6251 authored by Stan Hu's avatar Stan Hu

Merge branch 'ce-jej/group-saml-unlink-from-account' into 'master'

[CE] Backport GroupSAML unlink changes

See merge request gitlab-org/gitlab-ce!23536
parents 334068b9 84352177
...@@ -144,11 +144,13 @@ ...@@ -144,11 +144,13 @@
.provider-btn-group { .provider-btn-group {
display: inline-block; display: inline-block;
margin-right: 10px; margin-right: 10px;
margin-bottom: 10px;
border: 1px solid $border-color; border: 1px solid $border-color;
border-radius: 3px; border-radius: 3px;
&:last-child { &:last-child {
margin-right: 0; margin-right: 0;
margin-bottom: 0;
} }
} }
......
...@@ -4,7 +4,7 @@ class Profiles::AccountsController < Profiles::ApplicationController ...@@ -4,7 +4,7 @@ class Profiles::AccountsController < Profiles::ApplicationController
include AuthHelper include AuthHelper
def show def show
@user = current_user render(locals: show_view_variables)
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
...@@ -23,4 +23,10 @@ class Profiles::AccountsController < Profiles::ApplicationController ...@@ -23,4 +23,10 @@ class Profiles::AccountsController < Profiles::ApplicationController
redirect_to profile_account_path redirect_to profile_account_path
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
private
def show_view_variables
{}
end
end end
...@@ -57,6 +57,10 @@ module AuthHelper ...@@ -57,6 +57,10 @@ module AuthHelper
auth_providers.reject { |provider| form_based_provider?(provider) } auth_providers.reject { |provider| form_based_provider?(provider) }
end end
def display_providers_on_profile?
button_based_providers.any?
end
def providers_for_base_controller def providers_for_base_controller
auth_providers.reject { |provider| LDAP_PROVIDER === provider } auth_providers.reject { |provider| LDAP_PROVIDER === provider }
end end
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
= link_to 'Enable two-factor authentication', profile_two_factor_auth_path, class: 'btn btn-success' = link_to 'Enable two-factor authentication', profile_two_factor_auth_path, class: 'btn btn-success'
%hr %hr
- if button_based_providers.any? - if display_providers_on_profile?
.row.prepend-top-default .row.prepend-top-default
.col-lg-4.profile-settings-sidebar .col-lg-4.profile-settings-sidebar
%h4.prepend-top-0 %h4.prepend-top-0
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
- else - else
= link_to omniauth_authorize_path(:user, provider), method: :post, class: 'provider-btn not-active' do = link_to omniauth_authorize_path(:user, provider), method: :post, class: 'provider-btn not-active' do
Connect Connect
= render_if_exists 'profiles/accounts/group_saml_unlink_buttons', group_saml_identities: local_assigns[:group_saml_identities]
%hr %hr
- if current_user.can_change_username? - if current_user.can_change_username?
.row.prepend-top-default .row.prepend-top-default
...@@ -66,7 +67,7 @@ ...@@ -66,7 +67,7 @@
%h4.prepend-top-0.danger-title %h4.prepend-top-0.danger-title
= s_('Profiles|Delete account') = s_('Profiles|Delete account')
.col-lg-8 .col-lg-8
- if @user.can_be_removed? && can?(current_user, :destroy_user, @user) - if current_user.can_be_removed? && can?(current_user, :destroy_user, current_user)
%p %p
= s_('Profiles|Deleting an account has the following effects:') = s_('Profiles|Deleting an account has the following effects:')
= render 'users/deletion_guidance', user: current_user = render 'users/deletion_guidance', user: current_user
...@@ -79,10 +80,10 @@ ...@@ -79,10 +80,10 @@
confirm_with_password: ('true' if current_user.confirm_deletion_with_password?), confirm_with_password: ('true' if current_user.confirm_deletion_with_password?),
username: current_user.username } } username: current_user.username } }
- else - else
- if @user.solo_owned_groups.present? - if current_user.solo_owned_groups.present?
%p %p
= s_('Profiles|Your account is currently an owner in these groups:') = s_('Profiles|Your account is currently an owner in these groups:')
%strong= @user.solo_owned_groups.map(&:name).join(', ') %strong= current_user.solo_owned_groups.map(&:name).join(', ')
%p %p
= s_('Profiles|You must transfer ownership or delete these groups before you can delete your account.') = s_('Profiles|You must transfer ownership or delete these groups before you can delete your account.')
- else - else
......
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