How can I ensure that only authorized people can see this Package in the Menu?

https://github.com/filipfonal/filament-log-manager I'm trying to write a policy, but it didn't work because there was no model. Can you help me ?
GitHub
GitHub - filipfonal/filament-log-manager: A simple and clear interf...
A simple and clear interface to preview, download and delete Laravel log files using Filament Admin. - GitHub - filipfonal/filament-log-manager: A simple and clear interface to preview, download an...
14 Replies
Lara Zeus
Lara Zeus4mo ago
you have to overwrite the page from the config and add your authorization to it https://github.com/filipfonal/filament-log-manager/issues/4#event-8172858929
GitHub
Feature Request: Way to add authorization? · Issue #4 · filipfonal/...
I think it would be great to have way to add authorization to the log manager page. Alternatively (or additionally) it could be nice to be able to set the page class FQCN in config, that way the pa...
Mehmet K.
Mehmet K.4mo ago
I'm not sure exactly how to do this. Can I solve this problem with middleware or another method?
Lara Zeus
Lara Zeus4mo ago
dont think its possible with middleware it's normal filament page just create a filament page in your app with the command make it extend Logs::class from the package set it in the package config add the canAccess
public static function canAccess(): bool
{
return false; // or other check
}
public static function canAccess(): bool
{
return false; // or other check
}
Mehmet K.
Mehmet K.4mo ago
I'm doing it this way, but am I on the right track?
No description
No description
Lara Zeus
Lara Zeus4mo ago
yes this should work
Mehmet K.
Mehmet K.4mo ago
It still didn't work, am I making a mistake somewhere?
Lara Zeus
Lara Zeus4mo ago
what exactly didnt work? from your screenshot now the page should not appear in the sidebar
Mehmet K.
Mehmet K.4mo ago
Frankly, I don't understand if I'm extending it in the wrong way.
No description
No description
No description
Lara Zeus
Lara Zeus4mo ago
did a q test its working with me 🙂
No description
No description
Mehmet K.
Mehmet K.4mo ago
It's very interesting indeed. Is it possible to send the test project to me?
Lara Zeus
Lara Zeus4mo ago
I just install it in my demo app to test you have shield installed? filament shield
Mehmet K.
Mehmet K.4mo ago
No I don't install shield
Lara Zeus
Lara Zeus4mo ago
I noticed the role in the menu I think you have something overwrite the canAccesee
Mehmet K.
Mehmet K.4mo ago
I haven't installed it yet, I'm thinking of installing spatie permission. That's why I created