You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/08/11 12:02:56 UTC
[1/2] git commit: updated refs/heads/master to f65dec4
Repository: cloudstack
Updated Branches:
refs/heads/master b1fa37861 -> f65dec4b0
Implemented condition that only admin or owner of the template can change its permissions using updateTemplatePermissions API
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f7e8d445
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f7e8d445
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f7e8d445
Branch: refs/heads/master
Commit: f7e8d445525e659ee007be5e4ef181ab8ee546e6
Parents: 3df847d
Author: Maneesha.P <ma...@citrix.com>
Authored: Wed Aug 5 14:28:00 2015 +0530
Committer: Maneesha.P <ma...@citrix.com>
Committed: Tue Aug 11 11:08:35 2015 +0530
----------------------------------------------------------------------
server/src/com/cloud/template/TemplateManagerImpl.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f7e8d445/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 e9581e2..6e9af8a 100644
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -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) {
[2/2] git commit: updated refs/heads/master to f65dec4
Posted by re...@apache.org.
Merge pull request #658 from manuiiit/pull-11
Implemented condition that only admin or owner of the template can change its permissions ..... using updateTemplatePermissions API
Consider this scenario :
In a domain, there are three User Accounts UA1, UA2,UA3
A private template is registered by UA1
Through the updateTemplatePermissions API, UA1 gives permission to both UA2 and UA3
Now, UA2, having been shared the template, can remove the permission of UA3(or add permissions to another account).
EXPECTED BEHAVIOR :
UA2 should not be able to to add/remove permissions of other accounts.
* pr/658:
Implemented condition that only admin or owner of the template can change its permissions using updateTemplatePermissions API
Signed-off-by: Remi Bergsma <gi...@remi.nl>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f65dec4b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f65dec4b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f65dec4b
Branch: refs/heads/master
Commit: f65dec4b0f346ec13b44d2b3f1a0a2c294012e39
Parents: b1fa378 f7e8d44
Author: Remi Bergsma <gi...@remi.nl>
Authored: Tue Aug 11 11:38:33 2015 +0200
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Tue Aug 11 11:38:33 2015 +0200
----------------------------------------------------------------------
server/src/com/cloud/template/TemplateManagerImpl.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------