@Test public void getLocation() throws Exception { final Path bucket1 = new Path(UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path bucket2 = new Path(UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory, Path.Type.volume)); final B2FileidProvider fileid = new B2FileidProvider(session).withCache(cache); new B2DirectoryFeature(session, fileid).mkdir(bucket1, null, new TransferStatus()); assertEquals("allPrivate", new B2BucketTypeFeature(session, fileid).getLocation(bucket1).getIdentifier()); new B2DeleteFeature(session, fileid).delete(Collections.singletonList(bucket1), new DisabledLoginCallback(), new Delete.DisabledCallback()); new B2DirectoryFeature(session, fileid).mkdir(bucket2, "allPublic", new TransferStatus()); assertEquals("allPublic", new B2BucketTypeFeature(session, fileid).getLocation(bucket2).getIdentifier()); new B2DeleteFeature(session, fileid).delete(Collections.singletonList(bucket2), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public Name getLocation(final Path file) { final Path container = containerService.getContainer(file); if(container.isRoot()) { return unknown; } for(Acl.UserAndRole role : container.attributes().getAcl().asList()) { if(role.getUser().equals(new Acl.GroupUser(Acl.GroupUser.EVERYONE))) { if(role.getRole().equals(new Acl.Role(Acl.Role.READ))) { return new B2BucketTypeName(BucketType.allPublic); } } } return new B2BucketTypeName(BucketType.allPrivate); }
B2BucketTypeFeature extends DefaultAclFeature implements AclPermission, Location { @Override public Name getLocation(final Path file) { final Path container = containerService.getContainer(file); if(container.isRoot()) { return unknown; } for(Acl.UserAndRole role : container.attributes().getAcl().asList()) { if(role.getUser().equals(new Acl.GroupUser(Acl.GroupUser.EVERYONE))) { if(role.getRole().equals(new Acl.Role(Acl.Role.READ))) { return new B2BucketTypeName(BucketType.allPublic); } } } return new B2BucketTypeName(BucketType.allPrivate); } }
B2BucketTypeFeature extends DefaultAclFeature implements AclPermission, Location { @Override public Name getLocation(final Path file) { final Path container = containerService.getContainer(file); if(container.isRoot()) { return unknown; } for(Acl.UserAndRole role : container.attributes().getAcl().asList()) { if(role.getUser().equals(new Acl.GroupUser(Acl.GroupUser.EVERYONE))) { if(role.getRole().equals(new Acl.Role(Acl.Role.READ))) { return new B2BucketTypeName(BucketType.allPublic); } } } return new B2BucketTypeName(BucketType.allPrivate); } B2BucketTypeFeature(final B2Session session, final B2FileidProvider fileid); }
B2BucketTypeFeature extends DefaultAclFeature implements AclPermission, Location { @Override public Name getLocation(final Path file) { final Path container = containerService.getContainer(file); if(container.isRoot()) { return unknown; } for(Acl.UserAndRole role : container.attributes().getAcl().asList()) { if(role.getUser().equals(new Acl.GroupUser(Acl.GroupUser.EVERYONE))) { if(role.getRole().equals(new Acl.Role(Acl.Role.READ))) { return new B2BucketTypeName(BucketType.allPublic); } } } return new B2BucketTypeName(BucketType.allPrivate); } B2BucketTypeFeature(final B2Session session, final B2FileidProvider fileid); @Override Acl getPermission(final Path file); @Override void setPermission(final Path file, final Acl acl); @Override List<Acl.User> getAvailableAclUsers(); @Override List<Acl.Role> getAvailableAclRoles(final List<Path> files); @Override Set<Name> getLocations(); @Override Name getLocation(final Path file); }
B2BucketTypeFeature extends DefaultAclFeature implements AclPermission, Location { @Override public Name getLocation(final Path file) { final Path container = containerService.getContainer(file); if(container.isRoot()) { return unknown; } for(Acl.UserAndRole role : container.attributes().getAcl().asList()) { if(role.getUser().equals(new Acl.GroupUser(Acl.GroupUser.EVERYONE))) { if(role.getRole().equals(new Acl.Role(Acl.Role.READ))) { return new B2BucketTypeName(BucketType.allPublic); } } } return new B2BucketTypeName(BucketType.allPrivate); } B2BucketTypeFeature(final B2Session session, final B2FileidProvider fileid); @Override Acl getPermission(final Path file); @Override void setPermission(final Path file, final Acl acl); @Override List<Acl.User> getAvailableAclUsers(); @Override List<Acl.Role> getAvailableAclRoles(final List<Path> files); @Override Set<Name> getLocations(); @Override Name getLocation(final Path file);  }