Skip to content

Commit 91b1571

Browse files
committed
CLOUDSTACK-2343: listGlobalLoadBalancerRules shouldn't list the
globalGSLBRules of other accounts imposing ACL checks
1 parent 52a9010 commit 91b1571

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,10 @@ public GlobalLoadBalancerRule updateGlobalLoadBalancerRule(UpdateGlobalLoadBalan
528528

529529
@Override
530530
public List<GlobalLoadBalancerRule> listGlobalLoadBalancerRule(ListGlobalLoadBalancerRuleCmd listGslbCmd) {
531+
532+
UserContext ctx = UserContext.current();
533+
Account caller = ctx.getCaller();
534+
531535
Integer regionId = listGslbCmd.getRegionId();
532536
Long ruleId = listGslbCmd.getId();
533537
List<GlobalLoadBalancerRule> response = new ArrayList<GlobalLoadBalancerRule>();
@@ -546,12 +550,14 @@ public List<GlobalLoadBalancerRule> listGlobalLoadBalancerRule(ListGlobalLoadBal
546550
if (gslbRule == null) {
547551
throw new InvalidParameterValueException("Invalid gslb rule id specified");
548552
}
553+
_accountMgr.checkAccess(caller, org.apache.cloudstack.acl.SecurityChecker.AccessType.ListEntry, false, gslbRule);
554+
549555
response.add(gslbRule);
550556
return response;
551557
}
552558

553559
if (regionId != null) {
554-
List<GlobalLoadBalancerRuleVO> gslbRules = _gslbRuleDao.listByRegionId(regionId);
560+
List<GlobalLoadBalancerRuleVO> gslbRules = _gslbRuleDao.listByAccount(caller.getAccountId());
555561
if (gslbRules != null) {
556562
response.addAll(gslbRules);
557563
}

0 commit comments

Comments
 (0)