mirror of https://github.com/apache/cloudstack.git
Implemented condition that only admin or owner of the template can change its permissions using updateTemplatePermissions API
This commit is contained in:
parent
3df847dfbb
commit
f7e8d44552
|
|
@ -1324,6 +1324,11 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
throw new InvalidParameterValueException("Update template permissions is an invalid operation on template " + template.getName());
|
||||
}
|
||||
|
||||
//Only admin or owner of the template should be able to change its permissions
|
||||
if (caller.getId() != ownerId && !isAdmin) {
|
||||
throw new InvalidParameterValueException("Unable to grant permission to account " + caller.getAccountName() + " as it is neither admin nor owner or the template");
|
||||
}
|
||||
|
||||
VMTemplateVO updatedTemplate = _tmpltDao.createForUpdate();
|
||||
|
||||
if (isPublic != null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue