cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [46/50] [abbrv] git commit: updated refs/heads/reporter to 3e1816d
Date Mon, 27 Jul 2015 08:43:34 GMT
BUG-ID: CLOUDSTACK-8483 - Private template not visible in project added new 'projectId' parameter
in createTemplate command and based current user, account and projectid decide the owner of
the template.

Signed-off-by: Pierre-Luc Dion <pdion891@apache.org>


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

Branch: refs/heads/reporter
Commit: fd17e47e152f161d4d5a66b102dc8832c8858607
Parents: f8ef13c
Author: Sudhansu <sudhansu.sahu@citrix.com>
Authored: Fri Mar 13 17:48:47 2015 +0530
Committer: Pierre-Luc Dion <pdion891@apache.org>
Committed: Sun Jul 26 10:27:48 2015 -0400

----------------------------------------------------------------------
 .../api/command/user/template/CreateTemplateCmd.java      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd17e47e/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index ae9205f..c8d6ce3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -217,18 +217,18 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
     public long getEntityOwnerId() {
         Long volumeId = getVolumeId();
         Long snapshotId = getSnapshotId();
-        Long accountId = null;
+        Account callingAccount = CallContext.current().getCallingAccount();
         if (volumeId != null) {
             Volume volume = _entityMgr.findById(Volume.class, volumeId);
             if (volume != null) {
-                _accountService.checkAccess(CallContext.current().getCallingAccount(), SecurityChecker.AccessType.UseEntry,
false, volume);
+                _accountService.checkAccess(callingAccount, SecurityChecker.AccessType.UseEntry,
false, volume);
             } else {
                 throw new InvalidParameterValueException("Unable to find volume by id=" +
volumeId);
             }
         } else {
             Snapshot snapshot = _entityMgr.findById(Snapshot.class, snapshotId);
             if (snapshot != null) {
-                _accountService.checkAccess(CallContext.current().getCallingAccount(), SecurityChecker.AccessType.UseEntry,
false, snapshot);
+                _accountService.checkAccess(callingAccount, SecurityChecker.AccessType.UseEntry,
false, snapshot);
             } else {
                 throw new InvalidParameterValueException("Unable to find snapshot by id="
+ snapshotId);
             }
@@ -239,7 +239,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
             if (project != null) {
                 if (project.getState() == Project.State.Active) {
                     Account projectAccount= _accountService.getAccount(project.getProjectAccountId());
-                    _accountService.checkAccess(CallContext.current().getCallingAccount(),
SecurityChecker.AccessType.UseEntry, false, projectAccount);
+                    _accountService.checkAccess(callingAccount, SecurityChecker.AccessType.UseEntry,
false, projectAccount);
                     return project.getProjectAccountId();
                 } else {
                     final PermissionDeniedException ex =
@@ -253,7 +253,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
             }
         }
 
-        return CallContext.current().getCallingAccount().getId();
+        return callingAccount.getId();
     }
 
     @Override


Mime
View raw message