F
Filament•5mo ago
Ahmad

How can i manage authorization for a custom page (not attached to resource)?

How can i manage authorization for a custom page (not attached to resource)? I have tried to use canAccess function, but that didn't work.
8 Replies
Lara Zeus
Lara Zeus•5mo ago
canView()?
Ahmad
Ahmad•5mo ago
didn't work either .
Lara Zeus
Lara Zeus•5mo ago
are you extending Filament\Pages\Page? this worked for me the page is hidden
public static function canAccess(): bool
{
return false;
}
public static function canAccess(): bool
{
return false;
}
Ahmad
Ahmad•5mo ago
Yeah, i'm extending Filament\Pages\Page but it's not working i just double checked. I went up the hierarchy to see where this function is called "canAccess" and i can't find it being called anywhere. Which version of Filament are you using? I have v3.1.11 on my side
Lara Zeus
Lara Zeus•5mo ago
i am in last version of 3.2 and I think this one exist from older versions do you have any other ploiceis can be effecting this!
Ahmad
Ahmad•5mo ago
nope, this is a custom settings page that I have which is not tied to any resource (Model), so policies should not affect that.
Lara Zeus
Lara Zeus•5mo ago
i am really out of ideas 🙂
Ahmad
Ahmad•5mo ago
it turns out i had to update to 3.2 for that to work 🙂 Thanks a lot for looking into it! 🙂