CLOUDSTACK-3364:

change updateIsoPermissions API to accept isextractable paramter from normal user
This commit is contained in:
Nitin Mehta 2013-12-03 14:54:59 -08:00
parent 2cbaf04b97
commit 03c78247cc

View File

@ -1264,18 +1264,14 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
updatedTemplate.setFeatured(isFeatured.booleanValue()); updatedTemplate.setFeatured(isFeatured.booleanValue());
} }
if (isExtractable != null && caller.getType() == Account.ACCOUNT_TYPE_ADMIN) {// Only if(isExtractable != null){
// ROOT // Only Root admins allowed to change it for templates
// admins if(!template.getFormat().equals(ImageFormat.ISO) && caller.getType() != Account.ACCOUNT_TYPE_ADMIN){
// allowed
// to
// change
// this
// powerful
// attribute
updatedTemplate.setExtractable(isExtractable.booleanValue());
} else if (isExtractable != null && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
throw new InvalidParameterValueException("Only ROOT admins are allowed to modify this attribute."); throw new InvalidParameterValueException("Only ROOT admins are allowed to modify this attribute.");
}else{
// For Isos normal user can change it, as their are no derivatives.
updatedTemplate.setExtractable(isExtractable.booleanValue());
}
} }
_tmpltDao.update(template.getId(), updatedTemplate); _tmpltDao.update(template.getId(), updatedTemplate);