mirror of
https://github.com/dyzulk/trustlab-api.git
synced 2026-01-26 13:22:05 +07:00
feat: implement manual CDN sync for CA certificates and establish master AI rules
This commit is contained in:
@@ -60,6 +60,32 @@ class RootCaApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function syncToCdn()
|
||||
{
|
||||
$this->authorizeAdminOrOwner();
|
||||
|
||||
try {
|
||||
$certificates = CaCertificate::all();
|
||||
$count = 0;
|
||||
|
||||
foreach ($certificates as $cert) {
|
||||
if ($this->sslService->uploadToCdn($cert)) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => "Successfully synced {$count} certificates to CDN."
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Sync failed: ' . $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
protected function authorizeAdminOrOwner()
|
||||
{
|
||||
if (!auth()->user()->isAdminOrOwner()) {
|
||||
|
||||
Reference in New Issue
Block a user