joomla/joomla-cms — pull request #5086 by Hackwar (2014-11-11 11:11:19+00:00)
Title: Implementing a clearAccessRights method

This PR implements a method that clears the access rights cache of the current JUser object. This is meant to help websites that sell memberships. Up till now, they had to process the payment of the currently logged in user, add that user to the new usergroups (which changes all his access rights) and then log out the user and force him to login again. This method allows you to change the access rights for this current user, clear the cached results and then for all new requests to the ACL system, you get the fresh data.

This does NOT work in circumstances where the admin changes the usergroups hierarchy around or changes permissions at one point. In that case, all users have to be logged out and actually all sessions have to be deleted once, before those changes take effect everywhere! There is no way around that.

Testinstructions:
* Write a component com_test with the following test.php:
``` php
clearAccessRights();
```
* Login to the frontend, call /index.php?option=com_test, see the output.
* Go into the backend and change the ACL, reload the page in the frontend and see that nothing changed.
* Open /index.php?option=com_test&clear=1 and then /index.php?option=com_test and see that the new changes have taken effect.

This is related to #4991