mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-2343: listGlobalLoadBalancerRules shouldn't list the
globalGSLBRules of other accounts imposing ACL checks
This commit is contained in:
parent
52a901099c
commit
91b15711b6
@ -528,6 +528,10 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GlobalLoadBalancerRule> listGlobalLoadBalancerRule(ListGlobalLoadBalancerRuleCmd listGslbCmd) {
|
public List<GlobalLoadBalancerRule> listGlobalLoadBalancerRule(ListGlobalLoadBalancerRuleCmd listGslbCmd) {
|
||||||
|
|
||||||
|
UserContext ctx = UserContext.current();
|
||||||
|
Account caller = ctx.getCaller();
|
||||||
|
|
||||||
Integer regionId = listGslbCmd.getRegionId();
|
Integer regionId = listGslbCmd.getRegionId();
|
||||||
Long ruleId = listGslbCmd.getId();
|
Long ruleId = listGslbCmd.getId();
|
||||||
List<GlobalLoadBalancerRule> response = new ArrayList<GlobalLoadBalancerRule>();
|
List<GlobalLoadBalancerRule> response = new ArrayList<GlobalLoadBalancerRule>();
|
||||||
@ -546,12 +550,14 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
|
|||||||
if (gslbRule == null) {
|
if (gslbRule == null) {
|
||||||
throw new InvalidParameterValueException("Invalid gslb rule id specified");
|
throw new InvalidParameterValueException("Invalid gslb rule id specified");
|
||||||
}
|
}
|
||||||
|
_accountMgr.checkAccess(caller, org.apache.cloudstack.acl.SecurityChecker.AccessType.ListEntry, false, gslbRule);
|
||||||
|
|
||||||
response.add(gslbRule);
|
response.add(gslbRule);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regionId != null) {
|
if (regionId != null) {
|
||||||
List<GlobalLoadBalancerRuleVO> gslbRules = _gslbRuleDao.listByRegionId(regionId);
|
List<GlobalLoadBalancerRuleVO> gslbRules = _gslbRuleDao.listByAccount(caller.getAccountId());
|
||||||
if (gslbRules != null) {
|
if (gslbRules != null) {
|
||||||
response.addAll(gslbRules);
|
response.addAll(gslbRules);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user