Files
Siro/backend/Admin/transit/org/admins_list.php
T

32 lines
900 B
PHP

<?php
// Admin/transit/org/admins_list.php — قائمة مشرفي مؤسسة (لفريق سيرو)
// POST/GET: org_id
require_once __DIR__ . '/../../../connect.php';
if ($role !== 'admin' && $role !== 'super_admin') {
jsonError('Unauthorized: Admin access required', 403);
}
try { $transit_con = Database::get('transit'); }
catch (Exception $e) { jsonError('Transit service unavailable', 503); }
$orgId = filterRequest('org_id', 'int');
if (!$orgId) jsonError('org_id is required', 400);
$st = $transit_con->prepare(
"SELECT id, name, phone, role, is_active, created_at
FROM transit_org_admins WHERE org_id=? ORDER BY created_at ASC"
);
$st->execute([$orgId]);
$admins = $st->fetchAll();
foreach ($admins as &$a) {
if (!empty($a['phone'])) {
$a['phone'] = $encryptionHelper->decryptData($a['phone']) ?: null;
}
}
unset($a);
jsonSuccess(['admins' => $admins]);