Skip to content

Commit 6de7128

Browse files
committed
Fix normal user being able to update domain and his account resource limits
1 parent b99a030 commit 6de7128

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,12 @@ protected void addTaggedResourceLimits(List<ResourceLimitVO> limits, ResourceTyp
903903
public ResourceLimitVO updateResourceLimit(Long accountId, Long domainId, Integer typeId, Long max, String tag) {
904904
Account caller = CallContext.current().getCallingAccount();
905905

906+
if (caller.getType().equals(Account.Type.NORMAL)) {
907+
logger.info("Throwing exception because only root admins and domain admins are allowed to update resource limits.");
908+
throw new PermissionDeniedException("Your account does not have the right access level to update resource limits.");
909+
}
910+
911+
906912
if (max == null) {
907913
max = (long)Resource.RESOURCE_UNLIMITED;
908914
} else if (max < Resource.RESOURCE_UNLIMITED) {

0 commit comments

Comments
 (0)