use of org.projectnessie.api.params.ReferencesParams in project nessie by projectnessie.
the class TreeApiImplWithAuthorization method getAllReferences.
@Override
public ReferencesResponse getAllReferences(ReferencesParams params) {
ImmutableReferencesResponse.Builder resp = ReferencesResponse.builder();
BatchAccessChecker check = startAccessCheck();
List<Reference> refs = super.getAllReferences(params).getReferences().stream().peek(ref -> check.canViewReference(RefUtil.toNamedRef(ref))).collect(Collectors.toList());
Set<NamedRef> notAllowed = check.check().keySet().stream().map(Check::ref).filter(Objects::nonNull).collect(Collectors.toSet());
refs.stream().filter(ref -> !notAllowed.contains(RefUtil.toNamedRef(ref))).forEach(resp::addReferences);
return resp.build();
}
Aggregations