outl1ne / nova-settings

A Laravel Nova tool for editing custom settings using native Nova fields.
MIT License
274 stars 97 forks source link

Subpages Authorization #105

Closed OliverZiegler closed 2 years ago

OliverZiegler commented 2 years ago

Currently one can only hide the entire Settings or hide on a per field basis. Hiding every field in a subpage still renders the navigation link, the page, and the save button.

It would be an awesome feature if we could also authorise entire subpages. So when a user is not allowed to see Subpage1 but Subpage2 the sidebar doesn't show Subpage1, we cannot update Subpage1 fields via API et cetera.

Tarpsvo commented 2 years ago

You can conditionally not add the settings fields in that case.

Ie

if (user()->isAdmin()) {
  NovaSettings::addSettingsFields([ ... ]);
}