mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Remove leftover testing logic and fix checkout permissions
Removed console logs and temporary testing code from the bootstrap-table view. Updated the transformer to correctly check checkout permissions against the Asset class instead of PredefinedKit.
This commit is contained in:
parent
72f58b0405
commit
eb054897d6
|
@ -3,6 +3,8 @@
|
|||
namespace App\Http\Transformers;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Asset;
|
||||
use App\Models\AssetModel;
|
||||
use App\Models\PredefinedKit;
|
||||
use App\Models\SnipeModel;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
@ -42,7 +44,7 @@ class PredefinedKitsTransformer
|
|||
$permissions_array['available_actions'] = [
|
||||
'update' => Gate::allows('update', PredefinedKit::class),
|
||||
'delete' => Gate::allows('delete', PredefinedKit::class),
|
||||
'checkout' => Gate::allows('checkout', PredefinedKit::class),
|
||||
'checkout' => Gate::allows('checkout', Asset::class),
|
||||
// 'clone' => Gate::allows('create', PredefinedKit::class),
|
||||
// 'restore' => Gate::allows('create', PredefinedKit::class),
|
||||
];
|
||||
|
|
|
@ -441,14 +441,10 @@
|
|||
}
|
||||
|
||||
function genericCheckinCheckoutFormatter(destination) {
|
||||
console.log(destination)
|
||||
return function (value,row) {
|
||||
console.log(value)
|
||||
console.log(row.user_can_checkout)
|
||||
// some extra logic for kits needs to go here
|
||||
|
||||
// The user is allowed to check items out, AND the item is deployable
|
||||
row.available_actions.checkout = true //this is for testing -- TODO: REMOVE!!!!
|
||||
if ((row.available_actions.checkout == true) && (row.user_can_checkout == true) && ((!row.asset_id) && (!row.assigned_to))) {
|
||||
|
||||
return '<a href="{{ config('app.url') }}/' + destination + '/' + row.id + '/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="{{ trans('general.checkout_tooltip') }}">{{ trans('general.checkout') }}</a>';
|
||||
|
|
Loading…
Reference in a new issue