From 9c5da1c6e393b6ffc67f2bcf594c1f1cbc71b2b0 Mon Sep 17 00:00:00 2001 From: Likitha Shetty Date: Fri, 5 Jul 2013 16:15:29 +0530 Subject: [PATCH] CLOUDSTACK-3361. [Projects] Allow a normal user to edit public templates created by him. --- server/src/com/cloud/acl/DomainChecker.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/acl/DomainChecker.java b/server/src/com/cloud/acl/DomainChecker.java index 8b20f3def5b..94cdfd108ad 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"); + } } } }