laratrust icon indicating copy to clipboard operation
laratrust copied to clipboard

isAbleTo function is very slow

Open joh3rd opened this issue 1 year ago • 2 comments

  • Laravel Version: 10.0
  • Laratrust Version: 8.0

Describe the bug The isAbleTofunction is very slow. I have many users with many teams and many permissions. In one case, a user has more than 8000 rows in the permission_user table. This is because of the user is assigned to many teams with a lot of permissions in every team. I'm checking permissions like that:

$user->isAbleTo(['permission_one', 'permission_two'], $teamId, true);

The DB query itself is super fast. I logged the raw query and tried that. But the isAbleTo function is very slow (more than two seconds in this case).

joh3rd avatar Jul 06 '23 06:07 joh3rd