JosephSilber / bouncer

Laravel Eloquent roles and abilities.
MIT License
3.43k stars 330 forks source link

setup with filament not working #631

Closed ankorinek closed 1 year ago

ankorinek commented 1 year ago

I'm trying to use this package with filament, but the documentation does not contain setup steps. I've setup bouncer and assigned some roles and abilities for a model, however forbidding everything still allows the user to perform all actions. Filament listens to policies, but setting that up and calling the bouncer "can" function there leads to an infinite loop. So what am I missing here? I cannot use routes or controllers since filament handles those automatically.

ankorinek commented 1 year ago

Figured out a workaround: create a policy for the models, and leave all functions blank, don't return anything and change the return type to void. This seems to enable filament's checks for abilities and triggers bouncer gate checks.