Restrict to update or create gate methods for select lists

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-02-11 12:31:11 -08:00
parent 9226c8292d
commit c1a0653847

View file

@ -179,12 +179,18 @@ class AuthServiceProvider extends ServiceProvider
// to the logged in API user, but creating assets, licenses, etc won't work // to the logged in API user, but creating assets, licenses, etc won't work
// if the user can't view and interact with the select lists. // if the user can't view and interact with the select lists.
Gate::define('view.selectlists', function ($user) { Gate::define('view.selectlists', function ($user) {
return $user->can('view', Asset::class) return $user->can('update', Asset::class)
|| $user->can('view', License::class) || $user->can('create', License::class)
|| $user->can('view', Component::class) || $user->can('update', License::class)
|| $user->can('view', Consumable::class) || $user->can('create', License::class)
|| $user->can('view', Accessory::class) || $user->can('update', Component::class)
|| $user->can('view', User::class); || $user->can('create', Component::class)
|| $user->can('update', Consumable::class)
|| $user->can('create', Consumable::class)
|| $user->can('update', Accessory::class)
|| $user->can('create', Accessory::class)
|| $user->can('update', User::class)
|| $user->can('create', User::class);
}); });
} }
} }