@Test public void testReadContainer() throws Exception { final Path container = new Path("test-acl-us-east-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Acl acl = new S3AccessControlListFeature(session).getPermission(container); assertTrue(acl.containsKey(new Acl.GroupUser("http: assertTrue(acl.get(new Acl.GroupUser("http: new Acl.Role(Acl.Role.WRITE) )); assertTrue(acl.get(new Acl.GroupUser("http: new Acl.Role("READ_ACP") )); assertTrue(acl.containsKey(new Acl.CanonicalUser("80b9982b7b08045ee86680cc47f43c84bf439494a89ece22b5330f8a49477cf6"))); assertTrue(acl.get(new Acl.CanonicalUser("80b9982b7b08045ee86680cc47f43c84bf439494a89ece22b5330f8a49477cf6")).contains( new Acl.Role(Acl.Role.FULL) )); }
@Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } }
S3AccessControlListFeature extends DefaultAclFeature implements AclPermission { @Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } } }
S3AccessControlListFeature extends DefaultAclFeature implements AclPermission { @Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } } S3AccessControlListFeature(final S3Session session); }
S3AccessControlListFeature extends DefaultAclFeature implements AclPermission { @Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } } S3AccessControlListFeature(final S3Session session); @Override Acl getPermission(final Path file); @Override void setPermission(final Path file, final Acl acl); @Override List<Acl.Role> getAvailableAclRoles(final List<Path> files); @Override List<Acl.User> getAvailableAclUsers(); }
S3AccessControlListFeature extends DefaultAclFeature implements AclPermission { @Override public Acl getPermission(final Path file) throws BackgroundException { try { if(file.getType().contains(Path.Type.upload)) { return Acl.EMPTY; } if(containerService.isContainer(file)) { return this.convert(session.getClient().getBucketAcl(containerService.getContainer(file).getName())); } else if(file.isFile() || file.isPlaceholder()) { return this.convert(session.getClient().getVersionedObjectAcl(file.attributes().getVersionId(), containerService.getContainer(file).getName(), containerService.getKey(file))); } return Acl.EMPTY; } catch(ServiceException e) { final BackgroundException failure = new S3ExceptionMappingService().map("Failure to read attributes of {0}", e, file); if(file.isPlaceholder()) { if(failure instanceof NotfoundException) { return Acl.EMPTY; } } if(failure instanceof InteroperabilityException) { return Acl.EMPTY; } throw failure; } } S3AccessControlListFeature(final S3Session session); @Override Acl getPermission(final Path file); @Override void setPermission(final Path file, final Acl acl); @Override List<Acl.Role> getAvailableAclRoles(final List<Path> files); @Override List<Acl.User> getAvailableAclUsers();  }