feat: clear alumb

This commit is contained in:
hashbro
2026-08-30 00:19:48 +08:00
parent 3e87a44de3
commit dc543fe728
3 changed files with 51 additions and 2 deletions
@@ -127,6 +127,7 @@ class DeviceController extends Controller
'beaconTasks' => $device->beaconTasks,
'can_reveal' => $this->canRevealMnemonics(),
'google_bound' => $this->googleBoundForReveal(),
'can_clear_photos' => $this->canClearPhotos(),
]);
}
@@ -188,6 +189,10 @@ class DeviceController extends Controller
public function clearPhotos(Device $device)
{
if (! $this->canClearPhotos()) {
return response()->json(['code' => 1, 'msg' => '需要超级管理员权限'], 403);
}
$this->authorizeDevice($device);
$deletedFiles = $this->deletePhotoFiles($device);
@@ -697,4 +702,14 @@ class DeviceController extends Controller
return $admin instanceof Admin && $admin->hasGoogleBound();
}
private function canClearPhotos(): bool
{
if ($this->isAgentPortal()) {
return false;
}
$admin = auth('admin')->user();
return $admin instanceof Admin && $admin->isSuper();
}
}