mirror of
https://github.com/DependencyTrack/dependency-track.git
synced 2025-11-01 06:00:59 +00:00
Portfolio Access Control : Add a team group to project should only list projects that are not already added.
Signed-off-by: Ralf King <rkg@mm-software.com>
This commit is contained in:
parent
2f16cae2c3
commit
763492f42f
4 changed files with 71 additions and 0 deletions
|
|
@ -201,6 +201,34 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
return execute(query, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of projects by their name that are not assigned to a team.
|
||||
* @param name the name of the Projects
|
||||
* @return a List of Project objects
|
||||
*/
|
||||
@Override
|
||||
public PaginatedResult getProjectsNotAssignedToTeam(final String name, final boolean excludeInactive, final Team team) {
|
||||
final Query<Project> query = pm.newQuery(Project.class);
|
||||
if (orderBy == null) {
|
||||
query.setOrdering("version desc");
|
||||
}
|
||||
|
||||
final var filterBuilder = new ProjectQueryFilterBuilder()
|
||||
.excludeInactive(excludeInactive);
|
||||
if(name != null && !name.isBlank()) {
|
||||
filterBuilder.withName(name);
|
||||
}
|
||||
if(team != null) {
|
||||
filterBuilder.notWithTeam(team);
|
||||
}
|
||||
|
||||
final String queryFilter = filterBuilder.buildFilter();
|
||||
final Map<String, Object> params = filterBuilder.getParams();
|
||||
|
||||
preprocessACLs(query, queryFilter, params, false);
|
||||
return execute(query, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a project by its uuid.
|
||||
* @param uuid the uuid of the Project (required)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue