cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject git commit: updated refs/heads/4.3 to c1be404
Date Tue, 03 Dec 2013 22:55:13 GMT
Updated Branches:
  refs/heads/4.3 fcab2b776 -> c1be40492


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/c1be4049
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c1be4049
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c1be4049

Branch: refs/heads/4.3
Commit: c1be40492460716502d62525418f1f712525bd7c
Parents: fcab2b7
Author: Nitin Mehta <nitin.mehta@citrix.com>
Authored: Tue Dec 3 14:54:59 2013 -0800
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Tue Dec 3 14:54:59 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/c1be4049/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 5ce499c..cbcd611 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1274,18 +1274,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);


Mime
View raw message