Skip to content

Commit 412af7c

Browse files
author
Prachi Damle
committed
RoleBasedEntityAccessChecker should skip Project resources. IAM does not support Projects yet.
1 parent 36fa355 commit 412af7c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedEntityAccessChecker.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ public boolean checkAccess(Account caller, ControlledEntity entity, AccessType a
8181
throw new InvalidParameterValueException("Entity and action cannot be both NULL in checkAccess!");
8282
}
8383

84+
// if a Project entity, skip
85+
Account entityAccount = _accountService.getAccount(entity.getAccountId());
86+
if (entityAccount != null && entityAccount.getType() == Account.ACCOUNT_TYPE_PROJECT) {
87+
return false;
88+
}
89+
8490
String entityType = null;
8591
if (entity.getEntityType() != null) {
8692
entityType = entity.getEntityType().getSimpleName();
@@ -128,6 +134,7 @@ public boolean checkAccess(Account caller, ControlledEntity entity, AccessType a
128134

129135
if (!policies.isEmpty()) { // Since we reach this point, none of the
130136
// roles granted access
137+
131138
if (s_logger.isDebugEnabled()) {
132139
s_logger.debug("Account " + caller + " does not have permission to access resource " + entity
133140
+ " for access type: " + accessType);

0 commit comments

Comments
 (0)