How to check permission for a user given a team #2697
Unanswered
WillGoldstein
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
First of all, nice package here!
Reading the docs, searching through the Q&A, etc, I believe this is the correct and only way to check if a user has a permission (or role) given a team context:
first get my user and team:
then 2 lines of setup...
...to be able to get to the lines where you get your answer:
My question is, why isn't there (or is there?) an easier method that accepts the team id to does 2 lines of setup work above? For example:
$hasRole = $user->hasRoleOnTeam("my_role",$team->id);
or
$user->hasPermissionOnTeamTo("own-only maintenance_records",$team->id);
And then in those methods it handles the
work that needs doing.
Or am I just missing something entirely?
Thanks!
Edit: Just saw this discussion, which leads me to believe it is not built yet, so either build it myself or make a PR. Appreciate any confirmation on that though just to make sure I'm not doing this wrong/missing something.
Beta Was this translation helpful? Give feedback.
All reactions