Fixed restore permission to assets API disable delete/checkin/checkout on deleted assets

This commit is contained in:
snipe 2017-11-22 10:35:24 -08:00
parent 66ac147c9e
commit 2278d5bfd8

View file

@ -111,10 +111,23 @@ class AssetsTransformer
'checkout' => (bool) Gate::allows('checkout', Asset::class), 'checkout' => (bool) Gate::allows('checkout', Asset::class),
'checkin' => (bool) Gate::allows('checkin', Asset::class), 'checkin' => (bool) Gate::allows('checkin', Asset::class),
'clone' => Gate::allows('create', Asset::class) ? true : false, 'clone' => Gate::allows('create', Asset::class) ? true : false,
'restore' => false,
'update' => (bool) Gate::allows('update', Asset::class), 'update' => (bool) Gate::allows('update', Asset::class),
'delete' => (bool) Gate::allows('delete', Asset::class), 'delete' => (bool) Gate::allows('delete', Asset::class),
]; ];
if ($asset->deleted_at!='') {
$permissions_array['available_actions'] = [
'checkout' => true,
'checkin' => false,
'clone' => Gate::allows('create', Asset::class) ? true : false,
'restore' => Gate::allows('create', Asset::class) ? true : false,
'update' => false,
'delete' => false,
];
}
$array += $permissions_array; $array += $permissions_array;
return $array; return $array;
} }