Disallow deleting in the API view if there are things checked out

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-04-16 12:30:23 -07:00
parent 8183b8deba
commit 79ff6a8fc2

View file

@ -56,7 +56,7 @@ class LicensesTransformer
'checkin' => Gate::allows('checkin', License::class),
'clone' => Gate::allows('create', License::class),
'update' => Gate::allows('update', License::class),
'delete' => Gate::allows('delete', License::class),
'delete' => (Gate::allows('delete', License::class) && ($license->seats == $license->availCount()->count())) ? true : false,
];
$array += $permissions_array;