summaryrefslogtreecommitdiff
path: root/app/views/admin/users/show.html.haml
blob: 08c1e089f2192d375b9f376ac13739300e05e979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
- add_to_breadcrumbs _("Users"), admin_users_path
- breadcrumb_title @user.name
- page_title @user.name, _("Users")
= render 'admin/users/head'

.row
  .col-md-6
    .card
      .card-header
        = @user.name
      %ul.content-list
        %li
          = image_tag avatar_icon_for_user(@user, 60), class: "avatar s60"
        %li
          %span.light= _('Profile page:')
          %strong
            = link_to user_path(@user) do
              = @user.username
    = render 'admin/users/profile', user: @user

    .card
      .card-header
        = _('Account:')
      %ul.content-list
        %li
          %span.light= _('Name:')
          %strong= @user.name
        %li
          %span.light= _('Username:')
          %strong
            = @user.username
        %li
          %span.light= _('Email:')
          %strong
            = render partial: 'shared/email_with_badge', locals: { email: mail_to(@user.email), verified: @user.confirmed? }
        - @user.emails.each do |email|
          %li
            %span.light= _('Secondary email:')
            %strong
              = render partial: 'shared/email_with_badge', locals: { email: email.email, verified: email.confirmed? }
            = link_to remove_email_admin_user_path(@user, email), data: { confirm: _("Are you sure you want to remove %{email}?") % { email: email.email } }, method: :delete, class: "btn btn-sm btn-danger gl-button btn-icon float-right", title: _('Remove secondary email'), id: "remove_email_#{email.id}" do
              = sprite_icon('close', size: 16, css_class: 'gl-icon')
        %li
          %span.light ID:
          %strong{ data: { qa_selector: 'user_id_content' } }
            = @user.id
        %li
          %span.light= _('Namespace ID:')
          %strong
            = @user.namespace_id

        %li.two-factor-status
          %span.light= _('Two-factor Authentication:')
          %strong{ class: @user.two_factor_enabled? ? 'cgreen' : 'cred' }
            - if @user.two_factor_enabled?
              = _('Enabled')
              = link_to _('Disable'), disable_two_factor_admin_user_path(@user), data: { confirm: _('Are you sure?') }, method: :patch, class: 'btn gl-button btn-sm btn-danger float-right', title: _('Disable Two-factor Authentication')
            - else
              = _('Disabled')

        = render_if_exists 'admin/namespace_plan_info', namespace: @user.namespace
        = render_if_exists 'admin/users/credit_card_info', user: @user

        %li
          %span.light= _('External User:')
          %strong
            = @user.external? ? _('Yes') : _('No')

        = render_if_exists 'admin/users/provisioned_by', user: @user

        %li
          %span.light= _('Can create groups:')
          %strong
            = @user.can_create_group ? _('Yes') : _('No')
        %li
          %span.light= _('Personal projects limit:')
          %strong
            = @user.projects_limit
        %li
          %span.light= _('Member since:')
          %strong
            = @user.created_at.to_s(:medium)
        - if @user.confirmed_at
          %li
            %span.light= _('Confirmed at:')
            %strong
              = @user.confirmed_at.to_s(:medium)
        - else
          %li
            %span.ligh= _('Confirmed:')
            %strong.cred
              = _('No')

        %li
          %span.light= _('Current sign-in IP:')
          %strong
            = @user.current_sign_in_ip || _('never')

        %li
          %span.light= _('Current sign-in at:')
          %strong
            = @user.current_sign_in_at&.to_s(:medium) || _('never')

        %li
          %span.light= _('Last sign-in IP:')
          %strong
            = @user.last_sign_in_ip || _('never')

        %li
          %span.light= _('Last sign-in at:')
          %strong
            = @user.last_sign_in_at&.to_s(:medium) || _('never')

        %li
          %span.light= _('Sign-in count:')
          %strong
            = @user.sign_in_count

        %li
          %span.light= _("Highest role:")
          %strong
            = Gitlab::Access.human_access_with_none(@user.highest_role)

        = render_if_exists 'admin/users/using_license_seat', user: @user

        - if @user.ldap_user?
          %li
            %span.light= _('LDAP uid:')
            %strong
              = @user.ldap_identity.extern_uid

        - if @user.created_by
          %li
            %span.light= _('Created by:')
            %strong
              = link_to @user.created_by.name, [:admin, @user.created_by]

        = render_if_exists 'namespaces/shared_runner_status', namespace: @user.namespace

    = render 'shared/custom_attributes', custom_attributes: @user.custom_attributes

  .col-md-6
    - unless @user == current_user
      - if can_force_email_confirmation?(@user)
        .gl-card.border-info.gl-mb-5
          .gl-card-header.bg-info.text-white
            = _('Confirm user')
          .gl-card-body
            - if @user.unconfirmed_email.present?
              - email = " (#{@user.unconfirmed_email})"
            %p= _('This user has an unconfirmed email address %{email}. You may force a confirmation.') % { email: email }
            %br
            = link_to _('Confirm user'), confirm_admin_user_path(@user), method: :put, class: "btn gl-button btn-info", data: { confirm: _('Are you sure?'), qa_selector: 'confirm_user_button' }

      = render 'admin/users/user_detail_note'

      - unless @user.internal?
        - if @user.deactivated?
          .gl-card.border-info.gl-mb-5
            .gl-card-header.bg-info.text-white
              = _('Reactivate this user')
            .gl-card-body
              = render partial: 'admin/users/user_activation_effects'
              %br
              %button.btn.gl-button.btn-info.js-confirm-modal-button{ data: user_activation_data(@user) }
                = s_('AdminUsers|Activate user')
        - elsif @user.can_be_deactivated?
          .gl-card.border-warning.gl-mb-5
            .gl-card-header.bg-warning.text-white
              = _('Deactivate this user')
            .gl-card-body
              = user_deactivation_effects
              %br
              %button.btn.gl-button.btn-warning.js-confirm-modal-button{ data: user_deactivation_data(@user, s_('AdminUsers|You can always re-activate their account, their data will remain intact.')) }
                = s_('AdminUsers|Deactivate user')
      - if @user.blocked?
        - if @user.blocked_pending_approval?
          = render 'admin/users/approve_user', user: @user
          = render 'admin/users/reject_pending_user', user: @user
        - elsif @user.banned?
          .gl-card.border-info.gl-mb-5
            .gl-card-header.gl-bg-blue-500.gl-text-white
              = _('This user is banned')
            .gl-card-body
              %p= _('A banned user cannot:')
              %ul
                %li= _('Log in')
                %li= _('Access Git repositories')
              - link_start = '<a href="%{url}" target="_blank">'.html_safe % { url: help_page_path("user/admin_area/moderate_users", anchor: "ban-a-user") }
              = s_('AdminUsers|Learn more about %{link_start}banned users.%{link_end}').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
              %p
              %button.btn.gl-button.btn-info.js-confirm-modal-button{ data: user_unban_data(@user) }
                = s_('AdminUsers|Unban user')
        - else
          .gl-card.border-info.gl-mb-5
            .gl-card-header.gl-bg-blue-500.gl-text-white
              = _('This user is blocked')
            .gl-card-body
              %p= _('A blocked user cannot:')
              %ul
                %li= _('Log in')
                %li= _('Access Git repositories')
              %br
              %button.btn.gl-button.btn-info.js-confirm-modal-button{ data: user_unblock_data(@user) }
                = s_('AdminUsers|Unblock user')
      - elsif !@user.internal?
        = render 'admin/users/block_user', user: @user
        = render 'admin/users/ban_user', user: @user

      - if @user.access_locked?
        .card.border-info.gl-mb-5
          .card-header.bg-info.text-white
            = _('This account has been locked')
          .card-body
            %p= _('This user has been temporarily locked due to excessive number of failed logins. You may manually unlock the account.')
            %br
            = link_to _('Unlock user'), unlock_admin_user_path(@user), method: :put, class: "btn gl-button btn-info", data: { confirm: _('Are you sure?') }
      - if !@user.blocked_pending_approval?
        .gl-card.border-danger.gl-mb-5
          .gl-card-header.bg-danger.text-white
            = s_('AdminUsers|Delete user')
          .gl-card-body
            - if @user.can_be_removed? && can?(current_user, :destroy_user, @user)
              %p= _('Deleting a user has the following effects:')
              = render 'users/deletion_guidance', user: @user
              %br
              %button.js-delete-user-modal-button.btn.gl-button.btn-danger{ data: { 'gl-modal-action': 'delete',
                delete_user_url: admin_user_path(@user),
                block_user_url: block_admin_user_path(@user),
                username: sanitize_name(@user.name) } }
                = s_('AdminUsers|Delete user')
            - else
              - if @user.solo_owned_groups.present?
                %p
                  = _('This user is currently an owner in these groups:')
                  %strong= @user.solo_owned_groups.map(&:name).join(', ')
                %p
                  = _('You must transfer ownership or delete these groups before you can delete this user.')
              - else
                %p
                  = _("You don't have access to delete this user.")

        .gl-card.border-danger
          .gl-card-header.bg-danger.text-white
            = s_('AdminUsers|Delete user and contributions')
          .gl-card-body
            - if can?(current_user, :destroy_user, @user)
              %p
                - link_to_ghost_user = link_to(_("system ghost user"), help_page_path("user/profile/account/delete_account"))
                = _("This option deletes the user and any contributions that would usually be moved to the %{link_to_ghost_user}. As well as the user's personal projects, groups owned solely by the user, and projects in them, will also be removed. Commits to other projects are unaffected.").html_safe % { link_to_ghost_user: link_to_ghost_user }
              %br
                %button.js-delete-user-modal-button.btn.gl-button.btn-danger{ data: { 'gl-modal-action': 'delete-with-contributions',
                  delete_user_url: admin_user_path(@user, hard_delete: true),
                  block_user_url: block_admin_user_path(@user),
                  username: @user.name } }
                  = s_('AdminUsers|Delete user and contributions')
            - else
              %p
                = _("You don't have access to delete this user.")

= render partial: 'admin/users/modals'