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

Eric Norman commented on SLING-10740:
-------------------------------------

>From what I can tell, the jcr session save() api is called in two places while 
>processing the repoinit operations:
 # In AclVisitor#visitCreatePath after processing a "create path" statement
 # In AclVisitor#visitSetAclPrincipalBased during processing of a "set 
principal ACL" statement when lookup of a target principal fails.  This seems 
to be a limitation of oak where it is not possible to create a principal and 
set a principal acl for that principal within the same transaction so this 
location does a save call to see if the principal is found after saving.

Due to the second use case, removing the save() call from 
AclVisitor#visitCreatePath would not be sufficient for all use cases since any 
"set principal ACL" statement for any unsaved new user would also cause the 
save() call to fail with the same constraint exception since the 
AclVisitor#visitSetAclPrincipalBased is called before 
NodePropertiesVisitor#visitSetProperties

I'll try to find some time to take a look at the oak code to see if there is 
some simple solution to the setting a principal acl on a "transient user" 
problem.   If that can't be solved in oak and both "save()" calls can't be 
removed then I would agree that extending the "create path" grammar with 
properties is probably the best solution.

> Repoinit create path statement fails for node types with a mandatory property
> -----------------------------------------------------------------------------
>
>                 Key: SLING-10740
>                 URL: https://issues.apache.org/jira/browse/SLING-10740
>             Project: Sling
>          Issue Type: Bug
>          Components: Repoinit
>            Reporter: Eric Norman
>            Assignee: Eric Norman
>            Priority: Major
>             Fix For: Repoinit JCR 1.1.38
>
>
> The processing of the "create path" statement calls save() at the end which 
> will cause a constraint violation if the nodetype of the created path 
> contains any properties that are declared as mandatory (and not autocreated). 
>  No processing of "set properties" statements happens before the save() call 
> in AclVisitor#visitCreatePath so it does not seem to be possible to define 
> any mandatory properties using the current repoinit grammar.
> I could see this solved in a couple ways:
>  # The AclVisitor#visitCreatePath could possibly pre-process any "set 
> properties" statements that are applicable to the created path before calling 
> save and then skip those same items when NodePropertiesVisitor visits the 
> same.
>  # Or, the "create path" grammar could be extended to allow defining 
> properties to be set at the same time as the create (with a syntax that is 
> similar to the "set properties" statement?)
>  # Or, perhaps calling save in AclVisitor#visitCreatePath is not necessary?  
> I'm not sure of the historical reasons why save() is done there.
>  # Or, maybe something else I haven't thought of
>  
>  



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

Reply via email to