use of diskCacheV111.util.FsPath in project dcache by dCache.
the class PrefixProfileFactory method create.
@Override
public T create(Map<String, String> arguments) {
String prefixConfig = arguments.get("prefix");
if (prefixConfig == null) {
throw new IllegalArgumentException("Missing 'prefix' argument.");
}
if (!prefixConfig.startsWith("/")) {
throw new IllegalArgumentException("Path in 'prefix' is not absolute: must start with '/'");
}
FsPath prefix = FsPath.create(prefixConfig);
return createProfile(prefix, arguments);
}
use of diskCacheV111.util.FsPath 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 diskCacheV111.util.FsPath in project dcache by dCache.
the class WlcgProfileScope method authorisation.
@Override
public Optional<MultiTargetedRestriction.Authorisation> authorisation(FsPath prefix) {
FsPath absPath = prefix.resolve(path.substring(1));
LOGGER.debug("WlcgProfileScope authorising {} with prefix \"{}\" to path {}", prefix, operation.allowedActivities, absPath);
return Optional.of(new Authorisation(operation.allowedActivities, absPath));
}
use of diskCacheV111.util.FsPath in project dcache by dCache.
the class XrootdDoor method deleteFile.
/**
* Delete the file denoted by path from the namespace
*
* @param path The path of the file that is going to be deleted
* @throws CacheException Deletion of the file failed
* @throws PermissionDeniedCacheException Caller does not have permission to delete the file
*/
public void deleteFile(FsPath path, Subject subject, Restriction restriction) throws PermissionDeniedCacheException, CacheException {
PnfsHandler pnfsHandler = new PnfsHandler(_pnfs, subject, restriction);
if (!isWriteAllowed(path)) {
throw new PermissionDeniedCacheException("Write permission denied");
}
Set<FileType> allowedSet = EnumSet.of(FileType.REGULAR);
PnfsId pnfsId = pnfsHandler.deletePnfsEntry(path.toString(), allowedSet);
sendRemoveInfoToBilling(pnfsId, path, subject);
}
use of diskCacheV111.util.FsPath in project dcache by dCache.
the class XrootdDoor method deleteDirectory.
/**
* Delete the directory denoted by path from the namespace
*
* @param path The path of the directory that is going to be deleted
* @throws CacheException
*/
public void deleteDirectory(FsPath path, Subject subject, Restriction restriction) throws CacheException {
PnfsHandler pnfsHandler = new PnfsHandler(_pnfs, subject, restriction);
if (!isWriteAllowed(path)) {
throw new PermissionDeniedCacheException("Write permission denied");
}
Set<FileType> allowedSet = EnumSet.of(FileType.DIR);
pnfsHandler.deletePnfsEntry(path.toString(), allowedSet);
}
Aggregations