@Override public List<Acl.UserAndRole> run(final Session<?> session) throws BackgroundException { final AclPermission feature = session.getFeature(AclPermission.class); final List<Acl.UserAndRole> updated = new ArrayList<Acl.UserAndRole>(); for(Path next : files) { if(this.isCanceled()) { throw new ConnectionCanceledException(); } if(Acl.EMPTY == next.attributes().getAcl()) { next.attributes().setAcl(feature.getPermission(next)); } for(Acl.UserAndRole acl : next.attributes().getAcl().asList()) { if(updated.contains(acl)) { continue; } updated.add(acl); } } return updated; }
public PathAttributes toAttributes(final Node node) throws BackgroundException { final PathAttributes attributes = new PathAttributes(); attributes.setVersionId(String.valueOf(node.getId())); attributes.setRevision(node.getBranchVersion()); attributes.setChecksum(Checksum.parse(node.getHash())); attributes.setCreationDate(node.getCreatedAt() != null ? node.getCreatedAt().getMillis() : -1L); attributes.setModificationDate(node.getUpdatedAt() != null ? node.getUpdatedAt().getMillis() : -1L); attributes.setSize(node.getSize()); attributes.setPermission(this.toPermission(node)); attributes.setAcl(this.toAcl(node)); final Map<String, String> custom = new HashMap<>(); if(null != node.getCntDownloadShares()) { custom.put(SDSAttributesFinderFeature.KEY_CNT_DOWNLOADSHARES, String.valueOf(node.getCntDownloadShares())); } if(null != node.getCntUploadShares()) { custom.put(SDSAttributesFinderFeature.KEY_CNT_UPLOADSHARES, String.valueOf(node.getCntUploadShares())); } custom.put(SDSAttributesFinderFeature.KEY_ENCRYPTED, String.valueOf(node.getIsEncrypted())); attributes.setCustom(custom); return attributes; }
attributes.setAcl(new AclDictionary().deserialize(aclObj));
@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { final AttributedList<Path> buckets = new AttributedList<Path>(); for(B2BucketResponse bucket : session.getClient().listBuckets()) { final PathAttributes attributes = new PathAttributes(); attributes.setVersionId(bucket.getBucketId()); switch(bucket.getBucketType()) { case allPublic: attributes.setAcl(new Acl(new Acl.GroupUser(Acl.GroupUser.EVERYONE, false), new Acl.Role(Acl.Role.READ))); break; } buckets.add(new Path(PathNormalizer.normalize(bucket.getBucketName()), EnumSet.of(Path.Type.directory, Path.Type.volume), attributes)); } listener.chunk(directory, buckets); return buckets; } catch(B2ApiException e) { throw new B2ExceptionMappingService().map("Listing directory {0} failed", e, directory); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } }
switch(response.getBucketType()) { case allPublic: folder.attributes().setAcl(new Acl(new Acl.GroupUser(Acl.GroupUser.EVERYONE, false), new Acl.Role(Acl.Role.READ)));