-
-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing resource to get all components #3720
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on your use-case for retrieving all components of all projects? Are you exporting/importing them into a BI solution?
src/main/java/org/dependencytrack/resources/v1/ComponentResource.java
Outdated
Show resolved
Hide resolved
@PermissionRequired(Permissions.Constants.VIEW_PORTFOLIO) | ||
public Response getComponents( | ||
try (QueryManager qm = new QueryManager(getAlpineRequest())) { | ||
final PaginatedResult result = qm.getComponents(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add ACL checks / filtering, similar to
dependency-track/src/main/java/org/dependencytrack/persistence/ProjectQueryManager.java
Lines 187 to 211 in db58e69
public PaginatedResult getProjects(final String name, final boolean excludeInactive, final boolean onlyRoot, final Team notAssignedToTeam) { | |
final Query<Project> query = pm.newQuery(Project.class); | |
if (orderBy == null) { | |
query.setOrdering("version desc"); | |
} | |
final var filterBuilder = new ProjectQueryFilterBuilder() | |
.excludeInactive(excludeInactive) | |
.withName(name); | |
if (onlyRoot) { | |
filterBuilder.excludeChildProjects(); | |
query.getFetchPlan().addGroup(Project.FetchGroup.ALL.name()); | |
} | |
if(notAssignedToTeam != null) { | |
filterBuilder.notWithTeam(notAssignedToTeam); | |
} | |
final String queryFilter = filterBuilder.buildFilter(); | |
final Map<String, Object> params = filterBuilder.getParams(); | |
preprocessACLs(query, queryFilter, params, false); | |
return execute(query, params); | |
} |
Signed-off-by: starfishfive <[email protected]>
Signed-off-by: starfishfive <[email protected]>
Signed-off-by: starfishfive <[email protected]>
Signed-off-by: starfishfive <[email protected]>
Hey guys, just to chime in my use case here, this would be useful since we have a lot of microservices (which are their own project), that we group with a parentProject It would be great if either the parentProject automatically includes components from its children, or that we could list all components so that we can keep track of all packages we are currently using. |
Description
Added a new get request to components resource for getting all components.
Addressed Issue
Fix #3719
Checklist
This PR fixes a defect, and I have provided tests to verify that the fix is effectiveThis PR introduces changes to the database model, and I have added corresponding [update logic](https://github.com/DependencyTrack/dependency-track/tree/master/src/main/java/org/dependencytrack/upgrade)