Closed Kovah closed 5 years ago
Seems to be related to #224
Isn't the master branch the current stable and tested branch?
You are correct in the actual state you can't create and assign a permission in the same request.
I'll change the precache_ids()
to public then you can rebuild the cache.
The 2.5-stable branch is update to v2.5.14 (latest version)
@REJack Change precache_ids() to public is not the best way to fix this problem, i made a PR for fix that #230
Issue closed
Hello, first of all thank you for your work on this library. But I have a serious problem with Aauth's permission caching.
The Situation
I use Aauth to add a bunch of new permissions by running something like this:
After that I want to assign these permissions to the default role. Therefore I am using the following code:
The Problem
Aauth does not save these group-permission relations in the database. On investigation I found that Aauth caches all permission IDs in
$this->cache_perm_id
in the construction method. I thought that running$this->aauth->get_perm($permission)
to just get the permission ID would work but it also tries to get the permission ID from the cache. So I can't create a permission and assign it to a group in the same request?!I am not sure if I miss something but there is no method to rebuild the cache or something similar and there is no mention of any caching in the documentation. In the moment that would mean I have to re-initialize Aauth just to access the permissions that are already saved in the database?
My suggestion would be to at least add a param for the
get_perm($permission)
method to force a database query for the given permission.