mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixed listProjects for regular user
This commit is contained in:
parent
f9144e1bf0
commit
809ad8ce23
@ -44,7 +44,7 @@ public class ListProjectsCmd extends BaseListCmd {
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list projects by project ID")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list projects by owner name")
|
||||
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list projects availabe for specified account")
|
||||
private String accountName;
|
||||
|
||||
@IdentityMapper(entityTableName="domain")
|
||||
|
||||
@ -368,6 +368,12 @@ public class ProjectManagerImpl implements ProjectManager, Manager{
|
||||
sb.join("domainSearch", domainSearch, sb.entity().getDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
if (accountId != null) {
|
||||
SearchBuilder<ProjectAccountVO> projectAccountSearch = _projectAccountDao.createSearchBuilder();
|
||||
projectAccountSearch.and("accountId", projectAccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
sb.join("projectAccountSearch", projectAccountSearch, sb.entity().getId(), projectAccountSearch.entity().getProjectId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
SearchCriteria<ProjectVO> sc = sb.create();
|
||||
|
||||
if (id != null) {
|
||||
@ -383,7 +389,7 @@ public class ProjectManagerImpl implements ProjectManager, Manager{
|
||||
}
|
||||
|
||||
if (accountId != null) {
|
||||
sc.addAnd("accountId", Op.EQ, accountId);
|
||||
sc.setJoinParameters("projectAccountSearch", "accountId", accountId);
|
||||
}
|
||||
|
||||
if (state != null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user