F
Filamentβ€’15mo ago
Chriis

How to manage roles and permissions ?

Hi, I'm currently working on my first Filament app, and I need to include roles and permissions, but I have no idea what the best way to do it is. I have two panels, one for admins and one for users. All resources are shared between both panels (my understanding of the relationship between panels and resources is still limited), but users need to have restricted permissions on these resources, unlike admins. At the moment, I have a "role" column in my "users" table, but I'm not really sure how to implement the rest. I've seen plugins for handling this, but I'm not sure if they fit my needs. A quick explanation of the roles and permissions landscape would be greatly appreciated πŸ™‚
No description
5 Replies
Patrick Boivin
Patrick Boivinβ€’15mo ago
Are you familiar with Policies in Laravel? https://laravel.com/docs/10.x/authorization
Chriis
ChriisOPβ€’15mo ago
Yes I am, but the thing is did I need like a "roles" table ? I don't know what's the best practice in Filament.
Vp
Vpβ€’15mo ago
Try #shield
Chriis
ChriisOPβ€’15mo ago
Ok, but Shield README doesn't specify the creation of a "role" column in the User model or something else, so there is nothing to do except adding the "HasRoles" trait to the User model ?
No description
Lara Zeus
Lara Zeusβ€’15mo ago
shield depends on spatie/laravel-permission check the db https://github.com/spatie/laravel-permission/tree/main/database/migrations
GitHub
laravel-permission/database/migrations at main Β· spatie/laravel-per...
Associate users with roles and permissions. Contribute to spatie/laravel-permission development by creating an account on GitHub.
Want results from more Discord servers?
Add your server