You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2013/07/05 13:01:01 UTC

git commit: updated refs/heads/4.2 to 640948d

Updated Branches:
  refs/heads/4.2 e0e8cb0d9 -> 640948d81


CLOUDSTACK-3361. [Projects] Allow a normal user to edit public templates created by him.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/640948d8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/640948d8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/640948d8

Branch: refs/heads/4.2
Commit: 640948d81899a1c7a6073a5d32d01110a9e740b8
Parents: e0e8cb0
Author: Likitha Shetty <li...@citrix.com>
Authored: Fri Jul 5 16:15:29 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Fri Jul 5 16:27:16 2013 +0530

----------------------------------------------------------------------
 server/src/com/cloud/acl/DomainChecker.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/640948d8/server/src/com/cloud/acl/DomainChecker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/acl/DomainChecker.java b/server/src/com/cloud/acl/DomainChecker.java
index 8b20f3d..94cdfd1 100755
--- a/server/src/com/cloud/acl/DomainChecker.java
+++ b/server/src/com/cloud/acl/DomainChecker.java
@@ -110,7 +110,10 @@ public class DomainChecker extends AdapterBase implements SecurityChecker {
                 // Domain admin and regular user can delete/modify only templates created by them
                 if (accessType != null && accessType == AccessType.ModifyEntry) {
                     if (!BaseCmd.isRootAdmin(caller.getType()) && owner.getId() != caller.getId()) {
-                        throw new PermissionDeniedException("Domain Admin and regular users can modify only their own Public templates");
+                        // For projects check if the caller account can access the project account
+                        if (owner.getType() != Account.ACCOUNT_TYPE_PROJECT || !(_projectMgr.canAccessProjectAccount(caller, owner.getId()))) {
+                            throw new PermissionDeniedException("Domain Admin and regular users can modify only their own Public templates");
+                        }
                     }
                 }
             }