Skip to content

Commit 238046f

Browse files
committed
Merge pull request #1834 from Accelerite/CLOUDSTACK-9679
CLOUDSTACK-9679:Allow master user to manage subordinate user uploaded template * pr/1834: CLOUDSTACK-9679:Allow master user to manage subordinate user uploaded template Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
2 parents c3c9b8f + 87849c3 commit 238046f

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

server/src/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3146,9 +3146,14 @@ private Pair<List<TemplateJoinVO>, Integer> searchForTemplatesInternal(Long temp
31463146
ex.addProxyObject(template.getUuid(), "templateId");
31473147
throw ex;
31483148
}
3149+
if (caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) {
3150+
Account template_acc = _accountMgr.getAccount(template.getAccountId());
3151+
DomainVO domain = _domainDao.findById(template_acc.getDomainId());
3152+
_accountMgr.checkAccess(caller, domain);
3153+
31493154

3150-
// if template is not public, perform permission check here
3151-
if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
3155+
}// if template is not public, perform permission check here
3156+
else if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
31523157
_accountMgr.checkAccess(caller, null, false, template);
31533158
}
31543159

ui/scripts/templates.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
filters: {
3636
all: {
3737
preFilter: function(args) {
38-
if (isAdmin()) //"listTemplates&templatefilter=all" only works for root-admin, but no domain-admin. Domain-admin is unable to see all templates until listTemplates API supports a new type of templatefilter for domain-admin to see all templates in his domain.
38+
if (isAdmin()|| isDomainAdmin()) //"listTemplates&templatefilter=all" only for root-admin and domain-admin. Domain-admin is able to see all templates in his domain.
3939
return true;
4040
else
4141
return false;
@@ -1914,7 +1914,7 @@
19141914
filters: {
19151915
all: {
19161916
preFilter: function(args) {
1917-
if (isAdmin()) //"listIsos&filter=all" only works for root-admin, but no domain-admin. Domain-admin is unable to see all Isos until listIsos API supports a new type of isofilter for domain-admin to see all Isos in his domain.
1917+
if (isAdmin()||isDomainAdmin()) //"listIsos&filter=all" works for root-admin and domain-admin. Domain-admin is able to see all Isos in his domain.
19181918
return true;
19191919
else
19201920
return false;

0 commit comments

Comments
 (0)