Skip to content

Commit 03c7824

Browse files
committed
CLOUDSTACK-3364:
change updateIsoPermissions API to accept isextractable paramter from normal user
1 parent 2cbaf04 commit 03c7824

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

‎server/src/com/cloud/template/TemplateManagerImpl.java‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,18 +1264,14 @@ public boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissions
12641264
updatedTemplate.setFeatured(isFeatured.booleanValue());
12651265
}
12661266

1267-
if (isExtractable != null && caller.getType() == Account.ACCOUNT_TYPE_ADMIN) {// Only
1268-
// ROOT
1269-
// admins
1270-
// allowed
1271-
// to
1272-
// change
1273-
// this
1274-
// powerful
1275-
// attribute
1276-
updatedTemplate.setExtractable(isExtractable.booleanValue());
1277-
} else if (isExtractable != null && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
1278-
throw new InvalidParameterValueException("Only ROOT admins are allowed to modify this attribute.");
1267+
if(isExtractable != null){
1268+
// Only Root admins allowed to change it for templates
1269+
if(!template.getFormat().equals(ImageFormat.ISO) && caller.getType() != Account.ACCOUNT_TYPE_ADMIN){
1270+
throw new InvalidParameterValueException("Only ROOT admins are allowed to modify this attribute.");
1271+
}else{
1272+
// For Isos normal user can change it, as their are no derivatives.
1273+
updatedTemplate.setExtractable(isExtractable.booleanValue());
1274+
}
12791275
}
12801276

12811277
_tmpltDao.update(template.getId(), updatedTemplate);

0 commit comments

Comments
 (0)