centralize roles guards

This commit is contained in:
Thanakorn S
2026-05-07 09:26:39 +07:00
parent 0d2fa3e3bd
commit a24930f684
13 changed files with 37 additions and 26 deletions
+15 -11
View File
@@ -1,17 +1,21 @@
<?php
<?php
session_start();
require '../../../assets/utils/db_auth.php';
$sql = "SELECT *
FROM user
WHERE
username not in ('support','extra')";
$sth = $pdo1->query($sql);
require_role($user_role, ['owner', 'admin']);
$sth = $pdo1->prepare(
"SELECT u.user_id, u.name, u.surname, u.email
FROM user u
INNER JOIN company_map_user m
ON m.user_id = u.user_id
AND m.company_id = :company_id
ORDER BY u.name ASC"
);
$sth->execute([':company_id' => $company_id]);
db_check($sth, $answer);
$answer["output"] = $sth->fetchAll(PDO::FETCH_ASSOC);
$answer["success"] = 1;
$answer['output'] = $sth->fetchAll(PDO::FETCH_ASSOC);
$answer['success'] = 1;
exit(json_encode($answer));
?>
?>