Fixed listProjects for regular user

This commit is contained in:
alena 2011-11-03 17:08:00 -07:00
parent f9144e1bf0
commit 809ad8ce23
2 changed files with 8 additions and 2 deletions

View File

@ -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")

View File

@ -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) {