Laravel-Backpack / PermissionManager

Admin interface for managing users, roles, permissions, using Backpack CRUD
http://backpackforlaravel.com
Other
527 stars 168 forks source link

Why a new admin account get redirected to /home instead of /admin/dashboard? #348

Closed gabrielfigueroa closed 11 months ago

gabrielfigueroa commented 11 months ago

Bug report

What I did:

I created a new admin user. Not the default admin account but a new user with the permission of Administrator.

What I expected to happen:

When I login I expect the exact same behavior as the admin account

What happened:

Instead of redirecting to /admin/dashboard it redirects to non-existing /home route

What I've already tried to fix it:

A lot of different things, from changing CONST HOME to trying to understand how the middleware RedirectIfAuthenticated.php works. Isn't this something that should work out of the box?

Backpack, Laravel, PHP, DB version:

PHP VERSION:

PHP 8.2.12 (cli) (built: Nov 11 2023 18:25:36) (NTS) Copyright (c) The PHP Group Zend Engine v4.2.12, Copyright (c) Zend Technologies with Zend OPcache v8.2.12, Copyright (c), by Zend Technologies

LARAVEL VERSION:

10.35.0.0

BACKPACK PACKAGE VERSIONS:

backpack/activity-log: 2.0.1 backpack/basset: 1.2.2 backpack/crud: 6.4.2 backpack/filemanager: 3.0.6 backpack/generators: v4.0.2 backpack/logmanager: v5.0.1 backpack/pagemanager: 3.2.0 backpack/permissionmanager: 7.1.1 backpack/pro: 2.0.20 backpack/revise-operation: 2.0.0 backpack/settings: 3.1.0 backpack/theme-coreuiv4: 1.1.1 backpack/theme-tabler: 1.1.2

welcome[bot] commented 11 months ago

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication mediums:

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

-- Justin Case The Backpack Robot

jcastroa87 commented 11 months ago

Hello @gabrielfigueroa what do you set as a "guard" is config/backpack/base.php ?

And i will need the "guard" on the "Roles" table to compare. The new user and the old adming share the same "guard"?

Thanks.

gabrielfigueroa commented 11 months ago

Hello @gabrielfigueroa what do you set as a "guard" is config/backpack/base.php ?

And i will need the "guard" on the "Roles" table to compare. The new user and the old adming share the same "guard"?

Thanks.

'guard' => 'backpack'

All records under roles have backpack as value on the guard_name field.

I fixed the problem temporarily by setting the field is_admin to 1 on the users table for said user.

jcastroa87 commented 11 months ago

So can you check if you have something special set in the method "checkIfUserIsAdmin" vendor/backpack/crud/src/app/Http/Middleware/CheckIfAdmin.php or if you overwrite this method.

Thanks.

jcastroa87 commented 11 months ago

Hello @gabrielfigueroa did you have a chance to check about that method?

Thanks.

jcastroa87 commented 11 months ago

Hi @gabrielfigueroa

Due to no activity I will close this issue, but if you need to continue you can reopen it or if it is a new issue, you can create a new issue.

Cheers.