Skip to content

Commit 1637792

Browse files
author
Jessica Wang
committed
CLOUDSTACK-544: cloudstack UI - template page, ISO page - edit, copy, download action is available if template/ISO and the login user is under the same project.
1 parent e113556 commit 1637792

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

ui/scripts/templates.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@
14041404
var allowedActions = [];
14051405

14061406
// "Edit Template", "Copy Template", "Create VM"
1407-
if ((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account)) //if neither root-admin, nor item owner
1407+
if ((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id)) //if neither root-admin, nor the same account, nor the same project
14081408
|| jsonObj.templatetype == "SYSTEM" || jsonObj.isready == false) {
14091409
//do nothing
14101410
}
@@ -1418,7 +1418,7 @@
14181418
}
14191419

14201420
// "Download Template"
1421-
if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account))) //if neither root-admin, nor item owner
1421+
if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project
14221422
|| (jsonObj.isready == false) || jsonObj.templatetype == "SYSTEM") {
14231423
//do nothing
14241424
}
@@ -1444,7 +1444,7 @@
14441444
var jsonObj = args.context.item;
14451445
var allowedActions = [];
14461446

1447-
if ((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account)) //if neither root-admin, nor item owner
1447+
if ((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id)) //if neither root-admin, nor the same account, nor the same project
14481448
|| (jsonObj.isready == false)
14491449
|| (jsonObj.domainid == 1 && jsonObj.account == "system")
14501450
) {
@@ -1460,7 +1460,7 @@
14601460
// "Create VM"
14611461
// Commenting this out for Beta2 as it does not support the new network.
14621462
/*
1463-
//if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account))
1463+
//if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id)) //if neither root-admin, nor the same account, nor the same project
14641464
if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account)) //if neither root-admin, nor item owner
14651465
|| jsonObj.isready == false)
14661466
|| (jsonObj.bootable == false)
@@ -1475,7 +1475,7 @@
14751475

14761476
// "Download ISO"
14771477
//if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account)))
1478-
if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account))) //if neither root-admin, nor item owner
1478+
if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project
14791479
|| (jsonObj.isready == false)
14801480
|| (jsonObj.domainid == 1 && jsonObj.account == "system")
14811481
) {

0 commit comments

Comments
 (0)