use of org.dcache.auth.attributes.Activity in project dcache by dCache.
the class ScopeBasedAuthzProfile method buildRestriction.
private Restriction buildRestriction(List<AuthorisationSupplier> scopes) {
Map<FsPath, MultiTargetedRestriction.Authorisation> authorisations = new HashMap<>();
scopes.stream().map(s -> s.authorisation(prefix)).filter(Optional::isPresent).map(Optional::get).forEach(a -> {
FsPath path = a.getPath();
MultiTargetedRestriction.Authorisation existing = authorisations.get(path);
if (existing != null) {
Collection<Activity> combined = EnumSet.copyOf(existing.getActivity());
combined.addAll(a.getActivity());
a = new MultiTargetedRestriction.Authorisation(combined, path);
}
authorisations.put(path, a);
});
return new MultiTargetedRestriction(authorisations.values());
}
use of org.dcache.auth.attributes.Activity in project dcache by dCache.
the class SciTokenPlugin method buildRestriction.
private Restriction buildRestriction(FsPath prefix, List<AuthorisationSupplier> scopes) {
Map<FsPath, Authorisation> authorisations = new HashMap<>();
scopes.stream().map(s -> s.authorisation(prefix)).filter(Optional::isPresent).map(Optional::get).forEach(a -> {
FsPath path = a.getPath();
Authorisation existing = authorisations.get(path);
if (existing != null) {
Collection<Activity> combined = EnumSet.copyOf(existing.getActivity());
combined.addAll(a.getActivity());
a = new Authorisation(combined, path);
}
authorisations.put(path, a);
});
return new MultiTargetedRestriction(authorisations.values());
}
Aggregations