@Override public List<Acl.Role> getAvailableAclRoles(final List<Path> files) { final List<Acl.Role> roles = new ArrayList<Acl.Role>(Arrays.asList( new Acl.Role(org.jets3t.service.acl.Permission.PERMISSION_FULL_CONTROL.toString()), new Acl.Role(org.jets3t.service.acl.Permission.PERMISSION_READ.toString())) ); for(Path file : files) { if(file.isVolume()) { // When applied to a bucket, this permission lets a user create objects, overwrite objects, and // delete objects in a bucket. This permission also lets a user list the contents of a bucket. // You cannot apply this permission to objects because bucket ACLs control who can upload, // overwrite, and delete objects. Also, you must grant READ permission if you grant WRITE permission. roles.add(new Acl.Role(org.jets3t.service.acl.Permission.PERMISSION_WRITE.toString())); break; } } return roles; } }
public NSImage iconForPath(final Path item) { if(item.isVolume()) { return icons.volumeIcon(controller.getSession().getHost().getProtocol(), 16); } return icons.fileIcon(item, 16); }
@Override public DescriptiveUrlBag toUrl(final Path file) { if(file.isVolume()) { return DescriptiveUrlBag.empty(); } final DescriptiveUrlBag list = new DescriptiveUrlBag(); if(file.isFile()) { final String download = String.format("%s/file/%s/%s", session.getClient().getDownloadUrl(), URIEncoder.encode(containerService.getContainer(file).getName()), URIEncoder.encode(containerService.getKey(file))); list.add(new DescriptiveUrl(URI.create(download), DescriptiveUrl.Type.http, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), Scheme.https.name().toUpperCase(Locale.ROOT)))); } return list; } }
protected void write(final Session<?> session, final AclPermission feature, final Path file) throws BackgroundException { if(this.isCanceled()) { throw new ConnectionCanceledException(); } listener.message(MessageFormat.format(LocaleFactory.localizedString("Changing permission of {0} to {1}", "Status"), file.getName(), acl)); feature.setPermission(file, acl); if(file.isVolume()) { // No recursion when changing container ACL } else if(file.isDirectory()) { if(callback.recurse(file, acl)) { for(Path child : session.getFeature(ListService.class).list(file, new WorkerListProgressListener(this, listener))) { this.write(session, feature, child); } } } }
private void addNavigation(final Path p) { pathPopupButton.addItemWithTitle(p.getAbsolute()); pathPopupButton.lastItem().setRepresentedObject(p.getAbsolute()); if(p.isVolume()) { pathPopupButton.lastItem().setImage(IconCacheFactory.<NSImage>get().volumeIcon(pool.getHost().getProtocol(), 16)); } else { pathPopupButton.lastItem().setImage(IconCacheFactory.<NSImage>get().fileIcon(p, 16)); } }
if(file.isVolume()) { iconImageView.setImage(IconCacheFactory.<NSImage>get().volumeIcon(session.getHost().getProtocol(), 32));