Spatie Roles & Permissions - Global

Hi, I'm trying to utilise roles & permissions in my multi-tenancy Filament app, have it all working pretty nicely, but the issue is I have to create roles on each tenancy. I instead wish to have roles defined at a global level, so I only have to create a role once, but can then allocate it to user based on tenancy. For example, User1 is a standard user on Tenant1 and a privileged user on Tenant2. User 2 only has standard user on Tenant2 and no access to any other tenants. I've created a global role to test it (where the team_id is left null), and whilst I can go in to a user and assign them to this global role, the global role does not show in the list of roles to be able to manage in the app. How can I get these roles into the table in the app, and allow them to be edited without having to do it direct in the database?
1 Reply
Hightower
HightowerOP9mo ago
So I’ve managed to extend the RoleResource etc and update the query so that Global Roles now also show in the list table, but when I click on one of the Global Roles to edit I get a 404. Pretty sure this is because it’s looking for a team_id, and as a global role doesn’t have one set in the database its getting itself all wobbly. Think I need some sort of “don’t worry about the team_id” statement but not sure where to start

Did you find this page helpful?