Filament Teams with Some Multi-Tenancy Features
Is it possible in Filament multitenancy to have a super admin who can access the site, create teams, and assign admins to members? Essentially, the super admin wouldn’t need to create a team upon first login.
4 Replies
The easy way is to create a separate panel for that without tenancy where you can manage the resources. If not you can create resources not scoped to tenant and set the policies so that only super admin can access
Hello, Sir @Bruno Pereira . Could you please provide some clarification on this? I am new to Filament and have been trying to implement this for several days. What do you mean by
separate panel without tenancy
and create resources not scoped to tenant
?
--
Technically, my idea is simple. I created a super admin using a command, so I, as the admin, am not attached to any teams. However, logging into my panel gives me a 404 error since I’m not registered with a team on the fly. What I want is for the admin to be able to log in without any issues, create teams, create users, assign roles to users, and assign members to teams directly within the admin dashboard. Lastly, users should only be able to access data specific to their team.
Additionally, user might be belong to multiple teams that's why I used tenancy, so are you saying tenancy might not needed here?well. By app without tenancy you can have 2 panels my-site.com/admin (without tenancy) for the super admin to access and manage and then the my-site.com/app/{tenant} where the end users will access. This is option 1 where its separated from the tenancy panel.
Option 2 is 1 panel and you have the resources scoped to the tenant, that is, its related to the tenant. But for the superadmin you have other resource classes (keep in mind that you would have 2 resources for the same model) that aren't scoped to the tenant, aka global use of the panel.
Like so: https://filamentphp.com/docs/3.x/panels/tenancy#disabling-tenancy-for-a-resource
You need to basically create three panels. First panel is could be default panel (admin panel). Second you can create UserPanel and third is your Tenant panel. Try to setup multitenancy between User panel and Tenant panel. Use roles and permission to make clear separation between users with multi-tenancy. And users who will be respobsible for managing platform. Only they can access this Admin panel provider. Ofcourse you can setup rolses and permissions within this group of users.