summaryrefslogtreecommitdiff
path: root/lib/accounts.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-12-11 00:29:32 +0500
committerilotterytea <iltsu@alright.party>2025-12-11 00:29:32 +0500
commit84ca542d26832d5d995a3106e7cbf0acc1ede6f3 (patch)
tree2a0ed9cef68415b6a8fab580f81e71e6ca74d3e9 /lib/accounts.php
parent7e413a5d37346ec9512dca230f635dd57f1798e6 (diff)
feat: grant all permissions if user is admin
Diffstat (limited to 'lib/accounts.php')
-rw-r--r--lib/accounts.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/accounts.php b/lib/accounts.php
index 36f11af..a7a230e 100644
--- a/lib/accounts.php
+++ b/lib/accounts.php
@@ -49,8 +49,17 @@ function authorize_user(bool $required = false): bool
$_SESSION["user_role"] = null;
- if ($role_row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- $_SESSION["user_role"] = $role_row;
+ if ($role = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ if ($role["permission_admin"]) {
+ foreach ($role as $k => &$v) {
+ if (str_starts_with($k, 'permission_')) {
+ $v = 1;
+ }
+ }
+ unset($v);
+ }
+
+ $_SESSION["user_role"] = $role;
}
$stmt = $db->prepare("SELECT es.*, aes.is_default FROM emote_sets es