|
26 | 26 | import javax.ejb.Local; |
27 | 27 | import javax.inject.Inject; |
28 | 28 |
|
29 | | -import org.apache.log4j.Logger; |
30 | | -import org.springframework.stereotype.Component; |
31 | | - |
32 | 29 | import org.apache.cloudstack.acl.ControlledEntity.ACLType; |
33 | 30 | import org.apache.cloudstack.affinity.AffinityGroupDomainMapVO; |
34 | 31 | import org.apache.cloudstack.affinity.AffinityGroupResponse; |
|
100 | 97 | import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState; |
101 | 98 | import org.apache.cloudstack.framework.config.dao.ConfigurationDao; |
102 | 99 | import org.apache.cloudstack.query.QueryService; |
| 100 | +import org.apache.log4j.Logger; |
| 101 | +import org.springframework.stereotype.Component; |
103 | 102 |
|
104 | 103 | import com.cloud.api.query.dao.AccountJoinDao; |
105 | 104 | import com.cloud.api.query.dao.AffinityGroupJoinDao; |
@@ -386,6 +385,13 @@ private Pair<List<UserAccountJoinVO>, Integer> searchForUsersInternal(ListUsersC |
386 | 385 |
|
387 | 386 | boolean listAll = cmd.listAll(); |
388 | 387 | Long id = cmd.getId(); |
| 388 | + if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) { |
| 389 | + long currentId = CallContext.current().getCallingUser().getId(); |
| 390 | + if (id != null && currentId != id.longValue()) { |
| 391 | + throw new PermissionDeniedException("Calling user is not authorized to see the user requested by id"); |
| 392 | + } |
| 393 | + id = currentId; |
| 394 | + } |
389 | 395 | Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>( |
390 | 396 | cmd.getDomainId(), cmd.isRecursive(), null); |
391 | 397 | _accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), null, permittedAccounts, |
|
0 commit comments