vitodeploy / vito

The Ultimate Server Management Tool
https://vitodeploy.com
GNU Affero General Public License v3.0
1.06k stars 166 forks source link

New user get 500 | Server error #195

Closed dcswalle closed 4 months ago

dcswalle commented 5 months ago

Describe the bug After you create a new user, add a project and try to login you get 500 | Server error

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Users'
  2. Click on 'New User'
  3. Complete user details
  4. Select type of user - User or Admin
  5. After creation add a project to the user.
  6. Try to login

Expected behavior User should be able to login.

How you skip the 500 Server error

  1. Go to http://youserverip/profile
  2. Select the project

Screenshots image image

Additional context Here are some logs from laravel.log file: [2024-05-08 11:05:34] production.ERROR: App\Policies\ServerPolicy::viewAny(): Argument #2 ($project) must be of type App\Models\Project, null given, called in /home/vito/vito/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php on line 811 {"userId":4,"exception":"[object] (TypeError(code: 0): App\Policies\ServerPolicy::viewAny(): Argument #2 ($project) must be of type App\Models\Project, null given, called in /home/vito/vito/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php on line 811 at /home/vito/vito/app/Policies/ServerPolicy.php:12) [stacktrace]