Commit 70e6e625 authored by peterhegman's avatar peterhegman

Hide action buttons for special users

Hides the action buttons (Edit, Delete, Block, Deactivate)
for Ghost User, Alert Bot, and GitLab Support Bot.

The action buttons for these users was resulting on a 404
in the admin panel page.
parent 13851f12
...@@ -14,51 +14,52 @@ ...@@ -14,51 +14,52 @@
= _('Last activity') = _('Last activity')
.table-mobile-content .table-mobile-content
= user.last_activity_on.nil? ? _('Never') : l(user.last_activity_on, format: :admin) = user.last_activity_on.nil? ? _('Never') : l(user.last_activity_on, format: :admin)
.table-section.section-20.table-button-footer - unless user.internal?
.table-action-buttons .table-section.section-20.table-button-footer
= link_to _('Edit'), edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: 'btn btn-default' .table-action-buttons
- unless user == current_user = link_to _('Edit'), edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: 'btn btn-default'
%button.dropdown-new.btn.btn-default{ type: 'button', data: { toggle: 'dropdown' } } - unless user == current_user
= sprite_icon('settings') %button.dropdown-new.btn.btn-default{ type: 'button', data: { toggle: 'dropdown' } }
= sprite_icon('chevron-down') = sprite_icon('settings')
%ul.dropdown-menu.dropdown-menu-right = sprite_icon('chevron-down')
%li.dropdown-header %ul.dropdown-menu.dropdown-menu-right
= _('Settings') %li.dropdown-header
%li = _('Settings')
- if user.ldap_blocked?
%span.small
= s_('AdminUsers|Cannot unblock LDAP blocked users')
- elsif user.blocked?
= link_to _('Unblock'), unblock_admin_user_path(user), method: :put
- else
%button.btn{ data: { 'gl-modal-action': 'block',
url: block_admin_user_path(user),
username: sanitize_name(user.name) } }
= s_('AdminUsers|Block')
- if user.can_be_deactivated?
%li %li
%button.btn{ data: { 'gl-modal-action': 'deactivate', - if user.ldap_blocked?
url: deactivate_admin_user_path(user), %span.small
username: sanitize_name(user.name) } } = s_('AdminUsers|Cannot unblock LDAP blocked users')
= s_('AdminUsers|Deactivate') - elsif user.blocked?
- elsif user.deactivated? = link_to _('Unblock'), unblock_admin_user_path(user), method: :put
%li - else
= link_to _('Activate'), activate_admin_user_path(user), method: :put %button.btn{ data: { 'gl-modal-action': 'block',
- if user.access_locked? url: block_admin_user_path(user),
%li username: sanitize_name(user.name) } }
= link_to _('Unlock'), unlock_admin_user_path(user), method: :put, data: { confirm: _('Are you sure?') } = s_('AdminUsers|Block')
- if can?(current_user, :destroy_user, user) - if user.can_be_deactivated?
%li.divider %li
- if user.can_be_removed? %button.btn{ data: { 'gl-modal-action': 'deactivate',
%li url: deactivate_admin_user_path(user),
%button.delete-user-button.btn.text-danger{ data: { 'gl-modal-action': 'delete', username: sanitize_name(user.name) } }
delete_user_url: admin_user_path(user), = s_('AdminUsers|Deactivate')
block_user_url: block_admin_user_path(user), - elsif user.deactivated?
username: sanitize_name(user.name) } } %li
= s_('AdminUsers|Delete user') = link_to _('Activate'), activate_admin_user_path(user), method: :put
%li - if user.access_locked?
%button.delete-user-button.btn.text-danger{ data: { 'gl-modal-action': 'delete-with-contributions', %li
delete_user_url: admin_user_path(user, hard_delete: true), = link_to _('Unlock'), unlock_admin_user_path(user), method: :put, data: { confirm: _('Are you sure?') }
block_user_url: block_admin_user_path(user), - if can?(current_user, :destroy_user, user)
username: sanitize_name(user.name) } } %li.divider
= s_('AdminUsers|Delete user and contributions') - if user.can_be_removed?
%li
%button.delete-user-button.btn.text-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')
%li
%button.delete-user-button.btn.text-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: sanitize_name(user.name) } }
= s_('AdminUsers|Delete user and contributions')
---
title: Hide admin user actions for ghost and bot users
merge_request: 27162
author:
type: fixed
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