first commit
This commit is contained in:
33
backend/Admin/auth/list_pending.php
Normal file
33
backend/Admin/auth/list_pending.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin/auth/list_pending.php
|
||||
* عرض قائمة المشرفين الذين ينتظرون الموافقة
|
||||
* مسموح فقط للسوبر أدمن
|
||||
*/
|
||||
require_once __DIR__ . '/../../connect.php';
|
||||
|
||||
// التحقق من الصلاحيات
|
||||
if ($role !== 'super_admin') {
|
||||
http_response_code(403);
|
||||
echo json_encode(['error' => 'Forbidden. Super Admin access required.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$con = Database::get('main');
|
||||
|
||||
$stmt = $con->prepare("SELECT id, name, phone, created_at FROM adminUser WHERE status = 'pending' ORDER BY created_at DESC");
|
||||
$stmt->execute();
|
||||
$pending = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// فك تشفير الأسماء
|
||||
foreach ($pending as &$admin) {
|
||||
$admin['name'] = $encryptionHelper->decryptData($admin['name']) ?: $admin['name'];
|
||||
}
|
||||
|
||||
printSuccess($pending);
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log("[List Pending Admins Error] " . $e->getMessage());
|
||||
jsonError("Server Error: " . $e->getMessage());
|
||||
}
|
||||
Reference in New Issue
Block a user