settings_users: Only owner can deactivate other owners.

This commit adds the restriction of deactivating owners for admins
by disabling the deactivating button in the UI. Only owners are
allowed to deactivate other owners. The backend part of this is
already implemented in 86b52ef.
This commit is contained in:
sahil839 2020-06-06 03:42:52 +05:30 committed by Tim Abbott
parent c7a68d60f3
commit dbd64c4362
2 changed files with 2 additions and 1 deletions

View File

@ -228,6 +228,7 @@ function human_info(person) {
info.can_modify = page_params.is_admin;
info.is_current_user = people.is_my_user_id(person.user_id);
info.cannot_deactivate = info.is_current_user || person.is_owner && !page_params.is_owner;
info.display_email = settings_data.email_for_user_settings(person);
if (info.is_active) {

View File

@ -45,7 +45,7 @@
<td class="actions">
<span class="user-status-settings">
{{#if is_active}}
<button title="{{t 'Deactivate' }}" class="button rounded small deactivate btn-danger" {{#if is_current_user}}disabled="disabled"{{/if}}>
<button title="{{t 'Deactivate' }}" class="button rounded small deactivate btn-danger" {{#if cannot_deactivate}}disabled="disabled"{{/if}}>
<i class="fa fa-user-times" aria-hidden="true"></i>
</button>
{{else}}