@Override
    public void preflight(final Path source, final Path target) throws BackgroundException {
        if(source.isRoot() || new DeepboxPathContainerService(session).isContainer(source) || new DeepboxPathContainerService(session).isInTrash(source)) {
            throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Cannot rename {0}", "Error"), source.getName())).withFile(source);
        }
        if(target.isRoot() || new DeepboxPathContainerService(session).isContainer(target) || new DeepboxPathContainerService(session).isInTrash(target)) {
            throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Cannot create {0}", "Error"), target.getName()));
        }
        final Acl acl = source.attributes().getAcl();
        if(Acl.EMPTY == acl) {
            // Missing initialization
            log.warn(String.format("Unknown ACLs on %s", source));
            return;
        }
        if(!source.getName().equals(target.getName())) {
            if(!acl.get(new Acl.CanonicalUser()).contains(CANRENAME)) {
                if(log.isWarnEnabled()) {
                    log.warn(String.format("ACL %s for %s does not include %s", acl, source, CANRENAME));
                }
                throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Cannot rename {0}", "Error"), source.getName())).withFile(source);
            }
        }
        if(!fileid.getFileId(source.getParent()).equals(fileid.getFileId(target.getParent()))) {
            if(fileid.getBoxNodeId(source.getParent()).equals(fileid.getBoxNodeId(target.getParent()))) {
                if(!acl.get(new Acl.CanonicalUser()).contains(CANMOVEWITHINBOX)) {
                    if(log.isWarnEnabled()) {
                        log.warn(String.format("ACL %s for %s does not include %s", acl, source, CANMOVEWITHINBOX));
                    }
                    throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Cannot rename {0}", "Error"), source.getName())).withFile(source);
                }
            }
            else {
                if(!acl.get(new Acl.CanonicalUser()).contains(CANMOVEOUTOFBOX)) {
                    if(log.isWarnEnabled()) {
                        log.warn(String.format("ACL %s for %s does not include %s", acl, source, CANMOVEOUTOFBOX));
                    }
                    throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Cannot rename {0}", "Error"), source.getName())).withFile(source);
                }
            }
        }
    }
@Test
    public void testNoMoveRenameDocuments() throws Exception {
        final DeepboxIdProvider nodeid = new DeepboxIdProvider(session);
        final Path documents = new Path("/ORG 1 - DeepBox Desktop App/ORG1:Box1/Documents", EnumSet.of(Path.Type.directory, Path.Type.volume));
        final PathAttributes attributes = new DeepboxAttributesFinderFeature(session, nodeid).find(documents);
        assertFalse(attributes.getAcl().get(new Acl.CanonicalUser()).contains(CANMOVEWITHINBOX));
        assertFalse(attributes.getAcl().get(new Acl.CanonicalUser()).contains(CANMOVEOUTOFBOX));
        assertFalse(attributes.getAcl().get(new Acl.CanonicalUser()).contains(CANRENAME));
        assertThrows(AccessDeniedException.class, () -> new DeepboxMoveFeature(session, nodeid).preflight(documents, new Path(String.format("/ORG 1 - DeepBox Desktop App/%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.directory, Path.Type.volume))));
        assertThrows(AccessDeniedException.class, () -> new DeepboxMoveFeature(session, nodeid).preflight(documents, new Path(String.format("/ORG 4 - DeepBox Desktop App/%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.directory, Path.Type.volume))));
    }