Copilot commented on code in PR #11784:
URL: https://github.com/apache/cloudstack/pull/11784#discussion_r3955209297
##########
server/src/main/java/com/cloud/user/AccountManagerImpl.java:
##########
@@ -782,12 +781,7 @@ public void checkAccess(Account caller, AccessType
accessType, boolean sameOwner
HashMap<Long, List<ControlledEntity>> domains = new HashMap<>();
for (ControlledEntity entity : entities) {
- long domainId = entity.getDomainId();
- if (entity.getAccountId() != -1 && domainId == -1) { // If account
exists domainId should too so calculate
- // it. This condition might be hit for templates or entities
which miss domainId in their tables
- Account account =
ApiDBUtils.findAccountById(entity.getAccountId());
- domainId = account != null ? account.getDomainId() : -1;
- }
+ long domainId = getDomainIdFor(entity);
Review Comment:
The domainId is now resolved via getDomainIdFor(entity), but the domains map
still looks up existing entries using entity.getDomainId() (which can be -1).
This prevents previously grouped entities from being found and can cause the
entry for the resolved domainId to be overwritten, dropping earlier entities
from violation details.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]