as I want the user to be created during bundle content installation:
- created a .confg.xml file under /<content_dir>/src/main/content/jcr_root/home/users/system/<jcr:uuid from the created user in previous step> with the content specified in the example in instruction>
- added a filter instruction to/<content_dir>/src/main/content/META_INF/vault/filter.xml -> <filter root="/home/users/system" mode="merge"/>
- removed the user from jcr.
During bundle installation in aem following error occured:
Request failed: org.apache.jackrabbit.vault.packaging.PackageException: javax.jcr.nodetype.ConstraintViolationException: OakConstraint0001: /home/users/system[[rep:AuthorizableFolder, rep:AccessControllable]]: No matching definition found for child node q1_hkN-Qns4jK_Lt9ri_ with effective type [nt:folder] (500)
As to adding an amendment to ServiceUserMapper configuration,
- I've placed a file named org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-<service_user_name>-factory.xml
and I've performed the 3rd step of the instruction exactly as it's specified there, however the configuration does not seem to take place. I've checked that by looking at path /libs/system/config in jcr and checking as specified in 4th step of the instruction.
Have you encountered the same or similar problem or might now the solution to this one?
What I've done is just placed the file in content package in catalogue: <...>/jcr_root/apps/<app>/config/ which resulted in putting the file into the same location in JCR and initialization of an instance of the factory defined in there.
Looks like just correct jcr:primaryType was enough to make the functionality work.
Rename org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-<service_user_name>-factory.xml to org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-<service_user_name>.xml.
Also it is not required to use the name of the service is the name (as <service_user_name>), but it's just good practice.
That's a valid use case. Just create the user as mentioned in the article and assign permissions to specific paths via /useradmin and in the usermapper configuration, grant either read or write or both permissions (based on your use case) to the user against the bundle. Now, that system user can be utilized by that service bundle and would have read/write access to specific paths. All of this is done statically one time before you deploy your code bundle.
In your source code/bundle, you'd simply use this service user to perform some action.
I got confused with your statement - "as I want the user to be created during bundle content installation"
Could you please explain your use case? Why would you want to create "service user" progammatically at run time?
Per my knowledge, it requires admin credentials/session to create service user. How do you plan to get the "admin" session in your code and then make sure that you apply the configuration to the respective use case at run time?