-
1. Re: ModeShape and Spring-Jcr
hchiorean Jan 18, 2013 5:21 AM (in response to mgie)Hi Marius,
We don't have any "active" examples with Spring integration, but I'm thinking it should be pretty easy to integrate in the following way (hoping you're referring to a ModeShape 3.x version):
- create your own subclass of org.springframework.extensions.jcr.RepositoryFactoryBean (from the se-jcr Spring extension module)
- in the above subclass, use ModeShape's Java API and a JSON configuration file to start up & initialize the repository (see https://docs.jboss.org/author/display/MODE/ModeShape+in+Java+applications for the different ways in which you can start up the repository)
I think you can do this in 2 different ways: either using a ModeShapeEngine instance or use a JcrSessionFactory instance, both of which need a RepositoryConfiguration (see the above link for more information).
- after you have started the repository, all you need to do is to hold onto it and return in the RepositoryFactoryBean#createRepository method.
Hope this helps
-
2. Re: ModeShape and Spring-Jcr
hchiorean Jan 18, 2013 5:26 AM (in response to mgie)I've also created https://issues.jboss.org/browse/MODE-1759, so we hope to provide a Spring integration example with the next version.
-
3. Re: ModeShape and Spring-Jcr
mgie Jan 20, 2013 7:28 AM (in response to mgie)Thank you for your suggestions!
I was able to get it working using the ModeShapeEngine.
Anyhow, it seems like my evaluation of ModeShape will probably stop now as I just realized that it
seems not possible to model user-privileges on nodes in the repository. Is that correct?
One part of my applications repository would have to be a folder/file like structure with custom privileges per node-type like
view, execute, modify and such. The privileges should also be inherited from parent nodes of the same type.
Do I see it correctly that AccessControlManager.hasPrivileges (which ModeShape does not support) would be the only means
to achieve that? Or are there other possibilities using custom code (doesnt have to be jcr-api)?
Could a custom AuthorizationProvider do sth. like that?
kind regards,
Marius
-
4. Re: ModeShape and Spring-Jcr
hchiorean Jan 21, 2013 3:30 AM (in response to mgie)You are correct, ModeShape does not currently support the "access control management" feature (as defined by the JSR 283 spec)
However, if you have a look at org.modeshape.jcr.JcrSession#hasPermission method (which is called for pretty much all node operations) we have a pretty easy way of customizing access control logic, via a org.modeshape.jcr.security.AuthorizationProvider instance.
You can see some more details around this here: https://docs.jboss.org/author/display/MODE/Custom+authentication+providers
-
5. Re: ModeShape and Spring-Jcr
mgie Jan 21, 2013 4:01 AM (in response to hchiorean)Thanks for the answer. I have just read that description.
Is it possible to create some additional ModeShapePermissions?
I am asking because READ might be too unspecific for my application. Apart from the
operation on the repository itself I would like to map the permissions to some
additional applicationlevel meaning.
-
6. Re: ModeShape and Spring-Jcr
hchiorean Jan 21, 2013 4:18 AM (in response to mgie)Unfortunatelly from the perspective of the JCR layer implementation, we use the permissions from the {{ModeShapePermissions}} interface directly, so atm extending that wouldn't really work.