CLOUDSTACK-1054: When calling listDomains through the API do not restrict ADMIN users
When an admin calls this command without the ID parameter do not set the domain's ID to the ID where the admin is in, this prevents him from doing lookups. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/301c4413 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/301c4413 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/301c4413 Branch: refs/heads/javelin Commit: 301c4413bc4532d885ee739f8890da11ce3bfebc Parents: 1906f48 Author: Wido den Hollander <[email protected]> Authored: Fri Jan 25 14:45:08 2013 +0100 Committer: Wido den Hollander <[email protected]> Committed: Wed Jan 30 15:48:01 2013 +0100 ---------------------------------------------------------------------- server/src/com/cloud/user/DomainManagerImpl.java | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301c4413/server/src/com/cloud/user/DomainManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/user/DomainManagerImpl.java b/server/src/com/cloud/user/DomainManagerImpl.java index 54ca2ac..791f581 100644 --- a/server/src/com/cloud/user/DomainManagerImpl.java +++ b/server/src/com/cloud/user/DomainManagerImpl.java @@ -368,7 +368,9 @@ public class DomainManagerImpl implements DomainManager, DomainService, Manager } _accountMgr.checkAccess(caller, domain); } else { - domainId = caller.getDomainId(); + if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { + domainId = caller.getDomainId(); + } if (listAll) { isRecursive = true; }
