api: Prevent modifying acl rules order for default ACLs (#6187)

This commit is contained in:
Pearl Dsilva 2022-04-08 06:01:29 +05:30 committed by GitHub
parent daa7bdb046
commit c1c381fcd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1145,6 +1145,9 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
} }
NetworkACLVO acl = _networkACLDao.findById(aclId); NetworkACLVO acl = _networkACLDao.findById(aclId);
Vpc vpc = _entityMgr.findById(Vpc.class, acl.getVpcId()); Vpc vpc = _entityMgr.findById(Vpc.class, acl.getVpcId());
if (vpc == null) {
throw new InvalidParameterValueException("Re-ordering rules for a default ACL is prohibited");
}
Account caller = CallContext.current().getCallingAccount(); Account caller = CallContext.current().getCallingAccount();
_accountMgr.checkAccess(caller, null, true, vpc); _accountMgr.checkAccess(caller, null, true, vpc);
} }