feat: clear alumb
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user