-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fixed bug of loading user roles of different teams to current team #2803
base: main
Are you sure you want to change the base?
Conversation
It would be best to also add tests for the specific functionality you're trying to fix. |
You are adding extra queries, There are many notes in the documentation about using |
You could just do $user->roles()->attach($roleIdsArray, $theTeamId); |
@drbyte, @parallels999 I think it's a logical thing to expect that the package would take into consideration teamSessionId getting changed on the fly as the functionality is supported therefore it should assert to reload user roles before role-assigning (of course only when teams are enabled) as for there is no reason for reloading when not using teams. I think we should add this functionality as it is not a breaking change and it's been mentioned earlier |
@erikn69 does this need additional clarification?
if (app(PermissionRegistrar::class)->teams) { | ||
$this->load('roles'); | ||
} | ||
|
||
if ($model->exists) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the relationship be loaded only if the model already exists?
I still think this needs some specific tests regarding the problem that's being addressed. It's probable that the |
Fixes :