F
Filament2mo ago
阿信

Access Control for the Resource?

I am working on "ItrepairResource", and I want regular users to only be able to view the record after submitting the form. Only specific users who have roles such as 'Admin', 'AW4', 'AW5', 'NA_PT', 'IA_PT' (Auth::user()->roles()->whereIn('type', ['Admin', 'AW4', 'AW5', 'NA_PT', 'IA_PT'])->exists()) should be able to go to the Edit page and make edits. Where should I implement this feature? The attachment is my ItrepairResource.
3 Replies
Povilas K
Povilas K2mo ago
Users may access the Edit page if the update() method of the model policy returns true. https://filamentphp.com/docs/3.x/panels/resources/editing-records#authorization
Dennis Koch
Dennis Koch2mo ago
You probably also want to override the table query to limit the shown entries.