You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ni...@apache.org on 2013/12/03 23:55:47 UTC
git commit: updated refs/heads/master to 03c7824
Updated Branches:
refs/heads/master 2cbaf04b9 -> 03c78247c
CLOUDSTACK-3364:
change updateIsoPermissions API to accept isextractable paramter from normal user
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/03c78247
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/03c78247
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/03c78247
Branch: refs/heads/master
Commit: 03c78247ccb8dd260350b8102d6ec415d30e892f
Parents: 2cbaf04
Author: Nitin Mehta <ni...@citrix.com>
Authored: Tue Dec 3 14:54:59 2013 -0800
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Tue Dec 3 14:55:39 2013 -0800
----------------------------------------------------------------------
.../com/cloud/template/TemplateManagerImpl.java | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/03c78247/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index b3da060..f2fdcee 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1264,18 +1264,14 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
updatedTemplate.setFeatured(isFeatured.booleanValue());
}
- if (isExtractable != null && caller.getType() == Account.ACCOUNT_TYPE_ADMIN) {// Only
- // ROOT
- // admins
- // 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.");
+ if(isExtractable != null){
+ // Only Root admins allowed to change it for templates
+ if(!template.getFormat().equals(ImageFormat.ISO) && caller.getType() != Account.ACCOUNT_TYPE_ADMIN){
+ 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);