bezhanSalleh / filament-shield

The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages & Widgets through `spatie/laravel-permission`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

My UserPolicy does not allow me to open my own profile

zenepay opened this issue · comments

Please advise, I use

    public function view(User $user, User $model): bool
    {
        return $user->can('view_user');
    }

I expect to view my login profile https://localhost/office/user/users/3
It return 403 Forbidden
I have check $user->can('view_user) it return true correctly.
It looks like my resource does not allow me to open it.
but if I set to view_any_user, I can open any users.
What I have set wrong?

Maybe auth()->user()->can('view_user')?

if its a resource it should be auth()->user()->can('view_any_user')