F
Filament7mo ago
Jacob

Override default authorization logic

Is it possible to override the default authorization logic of the Filament Resource. When a user isn't allowed to view a resource (through policy) I want to show a Notification and redirect the user to the dashboard. How can I do that?
1 Reply
DrByte
DrByte7mo ago
The first place I'd start exploring there is the canView() method on the resource, which overrides the Policy when present, or passes through to the view() method on the Policy. Otherwise, when authorization fails, Filament throws a very generic 403. I suppose you could catch that, but overriding it earlier is better than intercepting an exception later, IMO