Update: 2026-05-04 00:29:31
This commit is contained in:
@@ -19,19 +19,17 @@ try {
|
||||
if ($role === 'super_admin') {
|
||||
// Super Admin sees ALL users from ALL tenants
|
||||
$stmt = $db->query("
|
||||
SELECT u.id, u.name, u.email, u.role, u.is_active, u.created_at, t.name as tenant_name, c.name as company_name
|
||||
SELECT u.id, u.name, u.email, u.role, u.is_active, u.created_at, t.name as tenant_name
|
||||
FROM users u
|
||||
LEFT JOIN tenants t ON u.tenant_id = t.id
|
||||
LEFT JOIN companies c ON u.company_id = c.id
|
||||
ORDER BY u.created_at DESC
|
||||
");
|
||||
} elseif ($role === 'admin') {
|
||||
// Admin sees only users in THEIR tenant (Accounting Office)
|
||||
$stmt = $db->prepare("
|
||||
SELECT u.id, u.name, u.email, u.role, u.is_active, u.created_at, t.name as tenant_name, c.name as company_name
|
||||
SELECT u.id, u.name, u.email, u.role, u.is_active, u.created_at, t.name as tenant_name
|
||||
FROM users u
|
||||
LEFT JOIN tenants t ON u.tenant_id = t.id
|
||||
LEFT JOIN companies c ON u.company_id = c.id
|
||||
WHERE u.tenant_id = ?
|
||||
ORDER BY u.created_at DESC
|
||||
");
|
||||
@@ -52,12 +50,6 @@ try {
|
||||
$decryptedEmail = Encryption::decrypt($user['email']);
|
||||
$user['email'] = $decryptedEmail !== false ? $decryptedEmail : $user['email'];
|
||||
|
||||
// Decrypt Company Name (if exists)
|
||||
if (!empty($user['company_name'])) {
|
||||
$decryptedCompanyName = Encryption::decrypt($user['company_name']);
|
||||
$user['company_name'] = $decryptedCompanyName !== false ? $decryptedCompanyName : $user['company_name'];
|
||||
}
|
||||
|
||||
// Decrypt Tenant Name (if exists)
|
||||
if (!empty($user['tenant_name'])) {
|
||||
$decryptedTenantName = Encryption::decrypt($user['tenant_name']);
|
||||
|
||||
Reference in New Issue
Block a user