From e56aef31bc38962e86ec7d4eae2e8397c2d7e755 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sun, 25 Jul 2021 15:59:58 -0600 Subject: [PATCH] api(application): allow updating a user's role --- app/Http/Requests/Api/Application/Users/StoreUserRequest.php | 2 +- app/Models/User.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php index 863cbea7..a1bb8f0e 100644 --- a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php @@ -21,7 +21,7 @@ class StoreUserRequest extends ApplicationApiRequest 'username', 'password', 'language', - 'root_admin', + 'admin_role_id', ])->toArray(); $response['first_name'] = $rules['name_first']; diff --git a/app/Models/User.php b/app/Models/User.php index 883fa6bf..86627e4b 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -94,7 +94,7 @@ class User extends Model implements 'use_totp', 'totp_secret', 'totp_authenticated_at', - 'gravatar', + 'admin_role_id', 'root_admin', ]; @@ -147,6 +147,7 @@ class User extends Model implements 'name_first' => 'required|string|between:1,191', 'name_last' => 'required|string|between:1,191', 'password' => 'sometimes|nullable|string', + 'admin_role_id' => 'sometimes|nullable|exists:admin_roles,id', 'root_admin' => 'boolean', 'language' => 'string', 'use_totp' => 'boolean',