Section: Use jAcl2 with jAuth
|« Configure jAcl2.db||^ jAcl2 : rights management||jAcl : old rights management »|
− Table of content
The mutual use of jAcl2 and jAuth is strongly probable. And you can raises questions about their integration. In fact this is dumb simple.
jAcl2 interacts with jAuth ¶
Nothing to do. jAcl2 needs jAuth to work. Just configure jAuth and jAcl2 will retrieve jAuth current user and then check rights through jAcl2::check().
jAuth interacts with jAcl2 ¶
For example, if you use jCommunity module (a module you'll find in Jelix forge) and jAcl2, you would want a new member to receive "defaults" rigths and when he will delete his account, its own rights would also be.
Generically, calling jAuth::saveNewUser, jAuth::removeUser and so on, should trigger updates to jAcl2 user rights.
This is not done automatically as it depends on the jAcl2 driver selected. As of now, only jAcl2.db driver exposes an API to do so.
The jacl2db module (in lib/jelix-modules) provides a listener to this event, for the db driver of jAcl2. It listen to AuthNewUser and AuthRemoveUser events to trigger rights updates. Then, jAcl2 will give default rights to a new member and will delete a member rights upon account deletion.
If you use another driver or create a new one, you will need to listen to those same events and act accordingly.