[ 
https://issues.apache.org/jira/browse/JCRVLT-751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17840188#comment-17840188
 ] 

Timothée Maret commented on JCRVLT-751:
---------------------------------------

With the PackageManager.assemble(session, opts, export) signature.

Here's the code that serialises the authorizable. 

{code}
private byte[] serialize(Session session, String authorizablePath) throws 
IOException, RepositoryException {

        /*
         * Serialize the authorizable node and it's deep
         * subtree (ACL, profile, etc.) in binary-less mode.
         * Skip auto-generated nodes and properties.
         */

        PathFilterSet nodeFilters = new PathFilterSet(authorizablePath);
        nodeFilters.addExclude(new DefaultPathFilter(".*/.tokens"));
        nodeFilters.addExclude(new DefaultPathFilter(".*/rep:cache"));

        PathFilterSet propertyFilters = new PathFilterSet(authorizablePath);
        propertyFilters.addExclude(new 
DefaultPathFilter("^.*/cq:lastReplicated"));
        propertyFilters.addExclude(new 
DefaultPathFilter("^.*/cq:lastReplicatedBy"));
        propertyFilters.addExclude(new 
DefaultPathFilter("^.*/cq:lastReplicationAction"));

        DefaultWorkspaceFilter filter = new DefaultWorkspaceFilter();
        filter.add(nodeFilters, propertyFilters);

        DefaultMetaInf inf = new DefaultMetaInf();
        inf.setFilter(filter);

        Properties props = new Properties();
        props.setProperty(VaultPackage.NAME_GROUP, "granite/sync");
        props.setProperty(VaultPackage.NAME_NAME, UUID.randomUUID().toString());
        props.setProperty(VaultPackage.NAME_VERSION, "0.0.1");
        props.setProperty(PackageProperties.NAME_USE_BINARY_REFERENCES, 
String.valueOf(true));
        inf.setProperties(props);

        ExportOptions opts = new ExportOptions();
        opts.setMetaInf(inf);

        opts.setRootPath(authorizablePath);
        opts.setMountPath(authorizablePath);

        opts.setCompressionLevel(Deflater.BEST_SPEED);

        try (ByteArrayOutputStream export = new ByteArrayOutputStream()) {
            packaging.getPackageManager().assemble(session, opts, export);
            export.flush();
            return export.toByteArray();
        }
    }
{code}

> Can't import a user with parent folder that starts with _ and includes 
> another _ 
> ---------------------------------------------------------------------------------
>
>                 Key: JCRVLT-751
>                 URL: https://issues.apache.org/jira/browse/JCRVLT-751
>             Project: Jackrabbit FileVault
>          Issue Type: Bug
>          Components: vlt
>    Affects Versions: 3.7.2
>            Reporter: Timothée Maret
>            Priority: Major
>              Labels: vault
>
> AEM has a user synchronisation capability in the publish tier. The 
> synchronisation mechanism relies on FileVault to export and import content.
> Users stored in the repository under a path that starts with a _ and that 
> contain another _ can be exported but fail to be re-imported. For instance, 
> the user stored under the path /home/users/test/_6k_test-user-a won't be 
> imported.
> Debugging this issue, it seems that FileVault treats the _6k_ pattern as a 
> namespace and thus skip the resource upon import because the paths don't 
> match.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to