Open blackfyre opened 2 years ago
Obviously this functionality doesn't exist at the moment. I hadn't planned on implementing this type of feature, but you are more than welcome to take this on and submit a PR.
Hi, canSee
is already implemented as this type of Authorization is a standard feature that all tools inherit from Laravel\Nova\Tool
You can use it like this, for example:
use Dniccum\NovaDocumentation\NovaDocumentation;
...
/**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array
*/
public function tools()
{
return [
// other tools
(new NovaDocumentation)->canSee(function ($request) {
return $request->user()->can('view documentation');
}),
];
}
@bluec That's true, however the ultimate scope is for individual pages instead of the complete tool.
Ah my apologies I hadn't noticed that you wanted to restrict access to individual pages.
That is not possible and I don't know how easily it could be added. I've been looking at tweaking a few things in this tool but the lack of any in-depth developer documentation on Nova Tools makes it hard work.
Our use case would require access control on select pages, any ideas on the feasibility? A
canSee
callback, like how it is on nova resource fields, added to the tool instantiation seems like a good starting point.