CLOUDSTACK-2657: listTemplatePermissions API should also include the owner of the template to the list of users having permission to launch
Changes: - Add template owner to the list of users Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/780b45e2 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/780b45e2 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/780b45e2 Branch: refs/heads/rbd-snap-clone Commit: 780b45e245aba1ca99d12fd4a8de88999642b4ae Parents: 7e6f3f9 Author: Prachi Damle <[email protected]> Authored: Thu May 23 16:32:34 2013 -0700 Committer: Prachi Damle <[email protected]> Committed: Thu May 23 16:33:07 2013 -0700 ---------------------------------------------------------------------- .../com/cloud/template/TemplateManagerImpl.java | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/780b45e2/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 d4976cd..517d4ba 100755 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -1553,6 +1553,13 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, accountNames.add(acct.getAccountName()); } } + + // also add the owner if not public + if (!template.isPublicTemplate()) { + Account templateOwner = _accountDao.findById(template.getAccountId()); + accountNames.add(templateOwner.getAccountName()); + } + return accountNames; }
