Commit a8e81fb4 authored by peterhegman's avatar peterhegman

Add "Managed Account" badge for GMA users

Also refactors badges into a partial to remove redundant code and
improve styling
parent 6c881698
- type ||= 'info'
%span.px-1.py-1
%span{ class: "badge badge-#{type}" }= yield
- if user.blocked?
= render 'shared/members/badge', type: 'danger' do
= _("Blocked")
- if user == current_user
= render 'shared/members/badge', type: 'success' do
= _("It's you")
......@@ -13,24 +13,23 @@
- if user
= image_tag avatar_icon_for_user(user, 40), class: "avatar s40 flex-shrink-0 flex-grow-0", alt: ''
.user-info
%span.mr-1
= link_to user.name, user_path(user), class: 'member js-user-link', data: { user_id: user.id }
= user_status(user)
%span.cgray= user.to_reference
.mx-n1.d-inline-flex.flex-wrap
= render_if_exists 'shared/members/ee/sso_badge', member: member
- if user == current_user
%span.badge.badge-success.prepend-left-5= _("It's you")
= render_if_exists 'shared/members/ee/gma_badge', member: member
= render 'shared/members/its_you_badge', user: user, current_user: current_user
= render_if_exists 'shared/members/ee/license_badge', user: user, group: @group
- if user.blocked?
%label.badge.badge-danger
%strong= _("Blocked")
= render 'shared/members/blocked_badge', user: user
- if user.two_factor_enabled?
%label.badge.badge-info
= _("2FA")
= render 'shared/members/two_factor_auth_badge', user: user
- if source.instance_of?(Group) && source != @group
·
......
- if user.two_factor_enabled?
= render 'shared/members/badge', type: 'info' do
= _("2FA")
......@@ -6,6 +6,10 @@ module EE
member.user.group_sso?(source)
end
def group_managed_account?
member.user.group_managed_account?
end
private
def override_member_permission
......
- if member.group_managed_account?
= render 'shared/members/badge', type: 'info' do
= _('Managed Account')
- if group.present? && group.has_owner?(current_user) && user.using_gitlab_com_seat?(group)
%span.badge.badge-light= _("Is using seat")
= render 'shared/members/badge', type: 'light' do
= _("Is using seat")
- if member.group_sso?
%span.badge.badge-info.prepend-left-5 SAML
= render 'shared/members/badge', type: 'info' do
SAML
......@@ -19,6 +19,17 @@ describe GroupMemberPresenter do
end
end
describe '#group_managed_account?' do
let(:saml_provider) { double(:saml_provider) }
let(:group) { double(:group) }
it 'calls through to User#group_managed_account?' do
expect(user).to receive(:group_managed_account?).and_return(true)
expect(presenter.group_managed_account?).to eq true
end
end
describe '#can_update?' do
context 'when user cannot update_group_member but can override_group_member' do
before do
......
......@@ -12449,6 +12449,9 @@ msgstr ""
msgid "Manage your license"
msgstr ""
msgid "Managed Account"
msgstr ""
msgid "Manifest"
msgstr ""
......
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