Allow users to update their auto_hold status
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 34s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m51s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
2024-10-17 16:25:49 +11:00
parent a3719b9186
commit b1560015ae
2 changed files with 10 additions and 4 deletions

View File

@@ -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];
}