Updated Branches: refs/heads/master 52a901099 -> 91b15711b
CLOUDSTACK-2343: listGlobalLoadBalancerRules shouldn't list the globalGSLBRules of other accounts imposing ACL checks Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/91b15711 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/91b15711 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/91b15711 Branch: refs/heads/master Commit: 91b15711b638f7ea604ef34cdfe60fcf845aec52 Parents: 52a9010 Author: Murali Reddy <[email protected]> Authored: Wed Jun 5 15:01:09 2013 +0530 Committer: Murali Reddy <[email protected]> Committed: Wed Jun 5 15:02:03 2013 +0530 ---------------------------------------------------------------------- .../gslb/GlobalLoadBalancingRulesServiceImpl.java | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91b15711/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java index 7c46d4a..483c19a 100644 --- a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java +++ b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java @@ -528,6 +528,10 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR @Override public List<GlobalLoadBalancerRule> listGlobalLoadBalancerRule(ListGlobalLoadBalancerRuleCmd listGslbCmd) { + + UserContext ctx = UserContext.current(); + Account caller = ctx.getCaller(); + Integer regionId = listGslbCmd.getRegionId(); Long ruleId = listGslbCmd.getId(); List<GlobalLoadBalancerRule> response = new ArrayList<GlobalLoadBalancerRule>(); @@ -546,12 +550,14 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR if (gslbRule == null) { throw new InvalidParameterValueException("Invalid gslb rule id specified"); } + _accountMgr.checkAccess(caller, org.apache.cloudstack.acl.SecurityChecker.AccessType.ListEntry, false, gslbRule); + response.add(gslbRule); return response; } if (regionId != null) { - List<GlobalLoadBalancerRuleVO> gslbRules = _gslbRuleDao.listByRegionId(regionId); + List<GlobalLoadBalancerRuleVO> gslbRules = _gslbRuleDao.listByAccount(caller.getAccountId()); if (gslbRules != null) { response.addAll(gslbRules); }
