Skip to content

Commit 1dbd10e

Browse files
author
Jessica Wang
committed
cloudstack 3.0 UI - Make Account page/User page available to normal-user role.
1 parent 1cd4ef5 commit 1dbd10e

2 files changed

Lines changed: 45 additions & 26 deletions

File tree

ui/scripts/accounts.js

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -619,16 +619,24 @@
619619
}
620620

621621
var accountObj = args.context.accounts[0];
622-
$.ajax({
623-
url: createURL("listUsers&domainid=" + accountObj.domainid + "&account=" + accountObj.name + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
624-
dataType: "json",
625-
success: function(json) {
626-
args.response.success({
627-
actionFilter: userActionfilter,
628-
data: json.listusersresponse.user
629-
});
630-
}
631-
})
622+
if(isAdmin() || isDomainAdmin()) {
623+
$.ajax({
624+
url: createURL("listUsers&domainid=" + accountObj.domainid + "&account=" + accountObj.name + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
625+
dataType: "json",
626+
success: function(json) {
627+
args.response.success({
628+
actionFilter: userActionfilter,
629+
data: json.listusersresponse.user
630+
});
631+
}
632+
})
633+
}
634+
else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
635+
args.response.success({
636+
actionFilter: userActionfilter,
637+
data: accountObj.user
638+
});
639+
}
632640
},
633641
actions: {
634642
add: {
@@ -970,18 +978,26 @@
970978
],
971979

972980
dataProvider: function(args) {
973-
$.ajax({
974-
url: createURL('listUsers'),
975-
data: {
976-
id: args.context.users[0].id
977-
},
978-
success: function(json) {
979-
args.response.success({
980-
actionFilter: userActionfilter,
981-
data: json.listusersresponse.user[0]
982-
});
983-
}
984-
});
981+
if(isAdmin() || isDomainAdmin()) {
982+
$.ajax({
983+
url: createURL('listUsers'),
984+
data: {
985+
id: args.context.users[0].id
986+
},
987+
success: function(json) {
988+
args.response.success({
989+
actionFilter: userActionfilter,
990+
data: json.listusersresponse.user[0]
991+
});
992+
}
993+
});
994+
}
995+
else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
996+
args.response.success({
997+
actionFilter: userActionfilter,
998+
data: args.context.users[0]
999+
});
1000+
}
9851001
}
9861002
}
9871003
}
@@ -1013,8 +1029,11 @@
10131029
}
10141030
allowedActions.push("remove");
10151031
}
1016-
}
1017-
allowedActions.push("updateResourceCount");
1032+
allowedActions.push("updateResourceCount");
1033+
}
1034+
else if(isDomainAdmin()) {
1035+
allowedActions.push("updateResourceCount");
1036+
}
10181037
return allowedActions;
10191038
}
10201039

ui/scripts/cloudStack.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
return ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects"];
1111
}
1212
else if (g_userProjectsEnabled) {
13-
return ["dashboard", "instances", "storage", "network", "templates", "events", "projects"];
13+
return ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "projects"];
1414
}
1515
else { //normal user
16-
return ["dashboard", "instances", "storage", "network", "templates", "events"];
16+
return ["dashboard", "instances", "storage", "network", "templates", "accounts", "events"];
1717
}
1818
},
1919
sections: {

0 commit comments

Comments
 (0)