-
-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Group Permissions and User cache #533
Comments
I also encountered a problem like this, how to fix it? |
There are three methods in GroupModel.php file which alter group permissions. They are addPermissionToGroup(), removePermissionFromGroup() and removePermissionFromAllGroups(). |
Next time when there will be a call to get user's permissions, new data will be retrieved from database and saved to cache. |
I faced this issue while using Then I checked the model between permissionModel & groupModel and see the difference. It means that when the
{
...
},
public function addPermissionToUser(int $permissionId, int $userId)
{
cache()->delete("{$userId}_permissions"); //these line
return $this->db->table('auth_users_permissions')->insert([
'user_id' => $userId,
'permission_id' => $permissionId,
]);
}
{
...
},
public function addPermissionToGroup(int $permissionId, int $groupId)
{
$data = [
'permission_id' => $permissionId,
'group_id' => $groupId,
];
return $this->db->table('auth_groups_permissions')->insert($data);
} alternative way can add this |
User permissions cache is not updated when Group permissions are altered, creating a potential lag time between adding/removing a group permission and the update to the user.
The text was updated successfully, but these errors were encountered: