You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2014/08/24 16:04:39 UTC
[19/50] [abbrv] git commit: updated refs/heads/saml2 to ba68616
CLOUDSTACK-7394:Caller should be owner after creating template from
snapshot/volume.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1436ce62
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1436ce62
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1436ce62
Branch: refs/heads/saml2
Commit: 1436ce62b61a2783a7c9d56d8611c5cb448cfd4e
Parents: b7f5e95
Author: Min Chen <mi...@citrix.com>
Authored: Thu Aug 21 17:14:37 2014 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Thu Aug 21 17:16:13 2014 -0700
----------------------------------------------------------------------
.../cloudstack/api/command/user/template/CreateTemplateCmd.java | 3 ++-
server/src/com/cloud/template/TemplateManagerImpl.java | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1436ce62/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 10b150d..aa076e4 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
@@ -266,7 +266,8 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException {
VirtualMachineTemplate template = null;
- template = _templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
+ //TemplateOwner should be the caller https://issues.citrite.net/browse/CS-17530
+ template = _templateService.createPrivateTemplateRecord(this, CallContext.current().getCallingAccount());
if (template != null) {
setEntityId(template.getId());
setEntityUuid(template.getUuid());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1436ce62/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 9214459..06ca5e0 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -31,7 +31,6 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import com.cloud.utils.DateUtil;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
@@ -160,6 +159,7 @@ import com.cloud.user.ResourceLimitService;
import com.cloud.user.User;
import com.cloud.user.dao.AccountDao;
import com.cloud.uservm.UserVm;
+import com.cloud.utils.DateUtil;
import com.cloud.utils.EnumUtils;
import com.cloud.utils.Pair;
import com.cloud.utils.component.AdapterBase;
@@ -1361,7 +1361,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
Long volumeId = command.getVolumeId();
Long snapshotId = command.getSnapshotId();
VMTemplateVO privateTemplate = null;
- final Long accountId = null;
+ final Long accountId = CallContext.current().getCallingAccountId();
SnapshotVO snapshot = null;
VolumeVO volume = null;