use of com.serotonin.m2m2.vo.FileStore in project ma-core-public by MangoAutomation.
the class FileStoreService method getStores.
/**
* List all file-stores that the user has read permission for
*/
public List<FileStore> getStores() {
List<FileStore> stores = new ArrayList<>();
this.customizedQuery(new ConditionSortLimit(null, null, null, null), (item) -> stores.add(item));
PermissionHolder user = Common.getUser();
Collection<FileStoreDefinition> moduleDefs = ModuleRegistry.getFileStoreDefinitions().values();
for (FileStoreDefinition def : moduleDefs) {
if (this.permissionService.hasPermission(user, def.getReadPermission())) {
stores.add(def.toFileStore());
}
}
return stores;
}
use of com.serotonin.m2m2.vo.FileStore in project ma-core-public by MangoAutomation.
the class FileStoreService method get.
/**
* @param xid xid of the user file store, or the storeName of the {@link FileStoreDefinition}
*/
@Override
public FileStore get(String xid) throws PermissionException, NotFoundException {
FileStore vo = getWithoutPermissionCheck(xid);
ensureReadPermission(Common.getUser(), vo);
return vo;
}
use of com.serotonin.m2m2.vo.FileStore in project ma-core-public by MangoAutomation.
the class FileStoreService method getPathWithinFileStore.
private FileStorePath getPathWithinFileStore(FileStore fileStore, String path) {
Path root = getFileStoreRoot(fileStore);
Path filePath = root.resolve(path).toAbsolutePath().normalize();
if (!filePath.startsWith(root)) {
throw new TranslatableIllegalArgumentException(new TranslatableMessage("filestore.invalidPath"));
}
return new FileStorePath(fileStore, filePath);
}
Aggregations