Unable to login when create new role
Hi everyone,
I am using bezhanSalleh/filament-shield package to created a new role. I created new role called "view_data," which only allows viewing data. Then, I created a new user and assigned this "view_data" role to him. However, when he tries to log in, it shows a "403 Forbidden" error. How can I fix this issue? Can anyone help me with this?
Solution:Jump to solution
The HasPanelShield trait provides an implementation for the canAccessPanel method, determining access based on whether the user possesses the super_admin role or the panel_user role. It also assigns the panel_user role to the user upon creation and removes it upon deletion. Ofcourse the role names can be changed from the plugin's configuration file.It's not an issue but the intended use case if you read the docs....
8 Replies
Forbidden right on the login or after login?
after login
What permissions did you set?
These are the screenshot for your reference @Dennis Koch
Is this maybe an issue because you limited
canAccessPanel()
on the User model?By default, they provide roles like "super admin" and "panel user," which work fine. However, when I create a new custom role and assign it to a user, it doesn't seem to work properly. Any ideas on how to resolve this issue?
The issue seems to be related to using the
HasPanelShield
trait in user model. This is likely causing the problem.
@Dennis Koch , I think the super admin and panel user have the permission to access the panel. how can i access panel other than roles
@Dennis Koch I fix this issues, i remove the HasPanelShield from the user model now it works fineSolution
The HasPanelShield trait provides an implementation for the canAccessPanel method, determining access based on whether the user possesses the super_admin role or the panel_user role. It also assigns the panel_user role to the user upon creation and removes it upon deletion. Ofcourse the role names can be changed from the plugin's configuration file.It's not an issue but the intended use case if you read the docs.
Sure @Dennis Koch