Allow users to update their auto_hold status
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
Reference in New Issue
Block a user