Replies: 1 comment 2 replies
-
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Issue:
We have routes with model/route binding like posts/{post:slug}. Also posts have a global scope that checks if the user's role exists and is one of x. All routes have middleware that checks if a users has access to the route and we have middleware that sets the permissions team id (setPermissionTeamId). However, when a post:slug is clicked, the rout/model binding takes place before all middleware is executed. So, at this point the user object exists, but does not have any role or permission attached.
The only way to overcome this is to use the setPermissionsTeamId in the global scope, which feels quite clumsy and not the way we would like to fix this.
question:
Is there a way to add the setPermissionTeamsId just before the route/model binding is executed, so the roles/permissions are available on the user object? An we do not have to add this one simple line to each global scope?
Tanks in advance.
I found another discussion about global scopes, but it did not really give me an answer to this issue.
Beta Was this translation helpful? Give feedback.
All reactions