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

Angela Schreiber commented on SLING-9857:
-----------------------------------------

[~cziegeler], no, there is no API to move around a user. if you want to use 
user management API you have to remove and recreate it. if you prefer to move 
around the node, you can use the _getPath_ method and use that to call 
{{Session.move}}. Note however, that is would rely on an implementation 
detail.... the user management API contract does not mandate that there exists 
a JCR Node in the repository backing the user/group. The default implementation 
does but if that were ever to change moving the JCR node would no longer work.

here what the API states about the getPath method:
{code}
@throws UnsupportedRepositoryOperationException If this method is not
     * supported or if there exists no accessible item associated with this
     * <code>Authorizable</code> instance.
{code}

so, it depends a bit on how much you are willing to rely on {{getPath}} to be 
supported. I don't remember all the details but I suspect that some pieces of 
the repo-init implementation already make use of the {{getPath}} method.
hope that helps

> Intermediate path is ignored if user/group already exists
> ---------------------------------------------------------
>
>                 Key: SLING-9857
>                 URL: https://issues.apache.org/jira/browse/SLING-9857
>             Project: Sling
>          Issue Type: Improvement
>          Components: Repoinit
>            Reporter: Angela Schreiber
>            Priority: Major
>
> Sling repoinit allows to create users/groups/service users with an optional 
> intermediate path (absolute or relative):
> {code}
> create service user my-feature-service with path system/my-feature
> create user my-feature-user with path /home/users/my-feature
> create group my-feature-group with path my-feature
> {code}
> however, in case the user/group/service user already exists the intermediate 
> path will be ignored.
> imo, there should be a way to make sure the intermediate path is respected 
> upon execution of {{CreateUser}}, {{CreateGroup}} and {{CreateServiceUser}} 
> operations.
> for example:
> h4. always verify and adjust path if needed
> in {{UserVisitor}}: if a group/user/service user already exists and the 
> create-operation includes a path (i.e. {{getPath()}} doesn't return 
> {{null}}), verify that {{Authorizable.getPath()}} is a descendant of that 
> path. If that's not the case move the corresponding node by either deleting 
> and recreating the user/group/service user or by actually moving.
> h4. global configuration option
> expand the repoinit such that handling of intermediate path can be configured 
> for all statements. for example add a configuration option to 
> {{JcrRepoInitOpsProcessorImpl}}. {{UserVisitor}} would only perform the 
> verification and potentially move, if the configuration option mandates it.
> the configuration could either be a simple boolean flag for this particular 
> case or be more sophisticated like e.g. 
> {{http://jackrabbit.apache.org/filevault/importmode.html}}.
> h4. expand repo-init statements
> if enforcing intermediate paths should not be dealt on a global level but on 
> a case by case basis, the create user/group/service user statements needed to 
> be expanded to allow for more fine-grained setup.  as with the previous 
> option it could be a simple flag or follow the example of 
> {{Jackrabbit-fvault}}, which defines a variety of import modes (see 
> http://jackrabbit.apache.org/filevault/importmode.html).
> h4. on a general note: 
> i see the benefit of the fine-grain import-modes (and ac-handling flags on 
> top of that, 
> http://jackrabbit.apache.org/filevault/apidocs/org/apache/jackrabbit/vault/fs/io/AccessControlHandling))
>  in jackrabbit-fvault. however, in a repository setup with many features, it 
> becomes increasingly difficult to manage and my personal preference would 
> rather be to keep it simple.
> note though SLING-6423: the fvault ac-handling flags already found their way 
> into the parser (implementation still missing though). so, maybe this issue 
> here in combination with SLING-6423 could be used to make a conscious 
> decision about the future development of repo-init beyond this improvement 
> and whether or not additional flexibility is desirable/needed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to