mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fixed permissions array to handle missing clone button
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
a88f622ec3
commit
033c3253bb
|
@ -116,22 +116,11 @@ class AssetsTransformer
|
||||||
$permissions_array['available_actions'] = [
|
$permissions_array['available_actions'] = [
|
||||||
'checkout' => Gate::allows('checkout', Asset::class),
|
'checkout' => Gate::allows('checkout', Asset::class),
|
||||||
'checkin' => Gate::allows('checkin', Asset::class),
|
'checkin' => Gate::allows('checkin', Asset::class),
|
||||||
'clone' => false,
|
|
||||||
'restore' => false,
|
|
||||||
'update' => (bool) Gate::allows('update', Asset::class),
|
|
||||||
'delete' => ($asset->assigned_to=='' && Gate::allows('delete', Asset::class)),
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($asset->deleted_at!='') {
|
|
||||||
$permissions_array['available_actions'] = [
|
|
||||||
'checkout' => true,
|
|
||||||
'checkin' => false,
|
|
||||||
'clone' => Gate::allows('create', Asset::class),
|
'clone' => Gate::allows('create', Asset::class),
|
||||||
'restore' => Gate::allows('create', Asset::class),
|
'restore' => ($asset->deleted_at!='' && Gate::allows('create', Asset::class)) ? true : false,
|
||||||
'update' => false,
|
'update' => (bool) Gate::allows('update', Asset::class),
|
||||||
'delete' => false,
|
'delete' => ($asset->deleted_at=='' && $asset->assigned_to =='' && Gate::allows('delete', Asset::class)),
|
||||||
];
|
];
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue