Skip to content

Commit 021a604

Browse files
author
Jessica Wang
committed
CLOUDSTACK-6789: UI > User page > fix a bug that a domain-admin was unable to delete other domain-admin in the same domain.
1 parent f3a0d25 commit 021a604

2 files changed

Lines changed: 13 additions & 23 deletions

File tree

ui/scripts/accounts.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,19 +1527,21 @@
15271527
allowedActions.push("enable");
15281528
allowedActions.push("remove");
15291529
}
1530-
} else {
1531-
if (isSelfOrChildDomainUser(jsonObj.username, jsonObj.accounttype, jsonObj.domainid, jsonObj.iscallerchilddomain)) {
1532-
if (isDomainAdmin() && jsonObj.username != g_username) {
1533-
allowedActions.push("edit");
1534-
if (jsonObj.state == "enabled")
1535-
allowedActions.push("disable");
1536-
if (jsonObj.state == "disabled")
1537-
allowedActions.push("enable");
1538-
allowedActions.push("remove");
1539-
}
1530+
} else { //domain-admin, regular-user
1531+
if (jsonObj.username == g_username) { //selected user is self
1532+
allowedActions.push("changePassword");
1533+
allowedActions.push("generateKeys");
1534+
} else if (isDomainAdmin()) { //if selected user is not self, and the current login is domain-admin
1535+
allowedActions.push("edit");
1536+
if (jsonObj.state == "enabled")
1537+
allowedActions.push("disable");
1538+
if (jsonObj.state == "disabled")
1539+
allowedActions.push("enable");
1540+
allowedActions.push("remove");
1541+
15401542
allowedActions.push("changePassword");
15411543
allowedActions.push("generateKeys");
1542-
}
1544+
}
15431545
}
15441546
return allowedActions;
15451547
}

ui/scripts/sharedFunctions.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -765,18 +765,6 @@ var addGuestNetworkDialog = {
765765
return (g_role == 0);
766766
}
767767

768-
function isSelfOrChildDomainUser(username, useraccounttype, userdomainid, iscallerchilddomain) {
769-
if (username == g_username) { //is self
770-
return true;
771-
} else if (isDomainAdmin() && !iscallerchilddomain && (useraccounttype == 0)) { //domain admin to user
772-
return true;
773-
} else if (isDomainAdmin() && iscallerchilddomain && (userdomainid != g_domainid)) { //domain admin to subdomain admin and user
774-
return true;
775-
} else {
776-
return false;
777-
}
778-
}
779-
780768
// FUNCTION: Handles AJAX error callbacks. You can pass in an optional function to
781769
// handle errors that are not already handled by this method.
782770

0 commit comments

Comments
 (0)