@Override
    public void preflight(Path file) throws BackgroundException {
        if(file.isRoot() || new DeepboxPathContainerService(session).isContainer(file)) {
            throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Cannot delete {0}", "Error"), file.getName())).withFile(file);
        }
        final Acl acl = file.attributes().getAcl();
        if(Acl.EMPTY == acl) {
            // Missing initialization
            log.warn(String.format("Unknown ACLs on %s", file));
            return;
        }
        if(new DeepboxPathContainerService(session).isInTrash(file)) {
            if(!acl.get(new Acl.CanonicalUser()).contains(CANPURGE)) {
                if(log.isWarnEnabled()) {
                    log.warn(String.format("ACL %s for %s does not include %s", acl, file, CANPURGE));
                }
                throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Cannot delete {0}", "Error"), file.getName())).withFile(file);
            }
        }
        else if(!acl.get(new Acl.CanonicalUser()).contains(CANDELETE)) {
            if(log.isWarnEnabled()) {
                log.warn(String.format("ACL %s for %s does not include %s", acl, file, CANDELETE));
            }
            throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Cannot delete {0}", "Error"), file.getName())).withFile(file);
        }
    }
@Test
    public void testNodeDeleteRoot() throws Exception {
        final DeepboxIdProvider nodeid = new DeepboxIdProvider(session);
        final Path folder = new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume));
        final PathAttributes attributes = new DeepboxAttributesFinderFeature(session, nodeid).find(folder);
        assertEquals(Acl.EMPTY, attributes.getAcl());
        assertThrows(AccessDeniedException.class, () -> new DeepboxTrashFeature(session, nodeid).preflight(folder.withAttributes(attributes)));
    }