This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new b866e40d17e Don't allow users to remove their account or user. (#7242)
b866e40d17e is described below

commit b866e40d17eb9dbf9389b91ba5d92711c8ca7660
Author: Sina Kashipazha <[email protected]>
AuthorDate: Mon Apr 17 14:15:57 2023 +0200

    Don't allow users to remove their account or user. (#7242)
---
 ui/src/config/section/account.js | 5 ++---
 ui/src/config/section/user.js    | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/ui/src/config/section/account.js b/ui/src/config/section/account.js
index 4de0cc6f5a4..4e69da72b92 100644
--- a/ui/src/config/section/account.js
+++ b/ui/src/config/section/account.js
@@ -195,9 +195,8 @@ export default {
       label: 'label.action.delete.account',
       message: 'message.delete.account',
       dataView: true,
-      show: (record, store) => {
-        return ['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) && 
!record.isdefault &&
-          !(record.domain === 'ROOT' && record.name === 'admin' && 
record.accounttype === 1)
+      disabled: (record, store) => {
+        return record.id !== 'undefined' && store.userInfo.accountid === 
record.id
       },
       groupAction: true,
       popup: true,
diff --git a/ui/src/config/section/user.js b/ui/src/config/section/user.js
index 894e4a678ff..c5a3325e892 100644
--- a/ui/src/config/section/user.js
+++ b/ui/src/config/section/user.js
@@ -144,9 +144,8 @@ export default {
       label: 'label.action.delete.user',
       message: 'message.delete.user',
       dataView: true,
-      show: (record, store) => {
-        return ['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) && 
!record.isdefault &&
-          !(record.domain === 'ROOT' && record.account === 'admin' && 
record.accounttype === 1)
+      disabled: (record, store) => {
+        return record.id !== 'undefined' && store.userInfo.id === record.id
       }
     }
   ]

Reply via email to