-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[Multi-Company] Fixes Users Being Moved With Items Still Assigned #15284
Conversation
PR Summary
|
@@ -427,13 +427,10 @@ public function show($id) : JsonResponse | array | |||
* @param \Illuminate\Http\Request $request | |||
* @param int $id | |||
*/ | |||
public function update(SaveUserRequest $request, $id) : JsonResponse | |||
public function update(SaveUserRequest $request, User $user): JsonResponse | |||
{ | |||
$this->authorize('update', User::class); |
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.
I'm assuming this can go away now, and was there to first check that a user could update users in general before doing the check to find the user? but wanted to double check.
Hm....tests failed on MySQL and PHP 8.3...
Another PR failed on the same or similar error recently. Kinda odd. I just re-triggered it and it went green. |
Yeah, that seems to happen sometimes. 🤷♀️ |
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.
This looks good to me. Nice use of $fail
to inline the validation errors 😄
Thanks to the article you sent! |
After merging this, I'm getting a gateway timeout when trying to create a new user. We're looking into it. |
}); | ||
}); | ||
|
||
Route::match(['put', 'patch'], '{user}/update', [Api\UsersController::class, 'update']) |
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.
This is causing a method not found error. #15435
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.
Fixed via #15440
Description
Adds a check to determine whether a user has any items assigned before being moved between companies. The logic happens in SaveUserRequest - so the logic works in both the UI and API. Route model binding is also now present for these routes - added to get the handy
$this->user
in the request, as well as remove some lines in the controllers.One shortcoming - if the user has un-reassignable licenses, then it gets difficult to move the user, because you'd need to make the license reassignable before checking it in. We can talk about that next time we chat.
Fixes #15265
Type of change
How Has This Been Tested?
Tests written.
Test Configuration: