Merge pull request #15982 from spencerrlongg/bug/sc-27228

Update Checkout Button Permission for Predefined Kits
This commit is contained in:
snipe 2024-12-19 22:25:51 +00:00 committed by GitHub
commit 8d24c0af0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -3,6 +3,7 @@
namespace App\Http\Transformers;
use App\Helpers\Helper;
use App\Models\Asset;
use App\Models\PredefinedKit;
use App\Models\SnipeModel;
use Illuminate\Support\Facades\Gate;
@ -42,7 +43,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),
];

View file

@ -279,8 +279,8 @@
element_name = '';
}
return function (value,row) {
return function (value,row) {
var actions = '<nobr>';
// Add some overrides for any funny urls we have
@ -441,7 +441,7 @@
}
function genericCheckinCheckoutFormatter(destination) {
return function (value,row) {
return function (value, row) {
// The user is allowed to check items out, AND the item is deployable
if ((row.available_actions.checkout == true) && (row.user_can_checkout == true) && ((!row.asset_id) && (!row.assigned_to))) {