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 throw new InvalidParameterValueException("Only ROOT admins are allowed to modify this attribute.");
// to }else{
// change // For Isos normal user can change it, as their are no derivatives.
// this updatedTemplate.setExtractable(isExtractable.booleanValue());
// 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.");
} }
_tmpltDao.update(template.getId(), updatedTemplate); _tmpltDao.update(template.getId(), updatedTemplate);