cleanup of redundant check for sameOwner (#4110)

Entity ownership is already being verified at line 508.
This commit is contained in:
Lucas Asth 2020-05-30 08:33:39 -03:00 committed by GitHub
parent d0d346524b
commit 630d826ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -507,14 +507,12 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
ControlledEntity prevEntity = null;
if (sameOwner) {
for (ControlledEntity entity : entities) {
if (sameOwner) {
if (ownerId == null) {
ownerId = entity.getAccountId();
} else if (ownerId.longValue() != entity.getAccountId()) {
throw new PermissionDeniedException("Entity " + entity + " and entity " + prevEntity + " belong to different accounts");
}
prevEntity = entity;
if (ownerId == null) {
ownerId = entity.getAccountId();
} else if (ownerId.longValue() != entity.getAccountId()) {
throw new PermissionDeniedException("Entity " + entity + " and entity " + prevEntity + " belong to different accounts");
}
prevEntity = entity;
}
}