diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 5581c58..7696bfa 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -488,10 +488,16 @@ class SystemController extends Controller public function api_autohold_toggle(Request $request,string $state): array { $o = System::findOrFail($request->id); - $o->autohold = $state === 'off' ? FALSE : TRUE; - $o->save(); - Log::debug(sprintf('%s:- Autohold set to [%s]',self::LOGKEY,$o->autohold ? 'ON' : 'OFF')); + if ($request->user()->can('update_nn',$o)) { + $o->autohold = !($state === 'off'); + $o->save(); + + Log::debug(sprintf('%s:- Autohold set to [%s]',self::LOGKEY,$o->autohold ? 'ON' : 'OFF')); + + } else { + abort(403); + } return ['autohold'=>$o->autohold]; } diff --git a/resources/views/system/widget/system.blade.php b/resources/views/system/widget/system.blade.php index 599914b..f3f6e51 100644 --- a/resources/views/system/widget/system.blade.php +++ b/resources/views/system/widget/system.blade.php @@ -303,7 +303,7 @@ use App\Models\{Mailer,User};