aboutsummaryrefslogtreecommitdiff
path: root/models/user.php
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2025-02-02 15:52:58 +0200
committerSyndamia <kamen@syndamia.com>2025-02-02 15:52:58 +0200
commite0fe3d0a5b6dd8bf4ba11eee10adfb6be3f5ab31 (patch)
treee0562c4683f27c7700ceb16e6faa3a06dd3f50f8 /models/user.php
parent179ebaebc36b6dc470dacad5a9020e4d6bf9921a (diff)
downloadnowayforward_human-e0fe3d0a5b6dd8bf4ba11eee10adfb6be3f5ab31.tar
nowayforward_human-e0fe3d0a5b6dd8bf4ba11eee10adfb6be3f5ab31.tar.gz
nowayforward_human-e0fe3d0a5b6dd8bf4ba11eee10adfb6be3f5ab31.zip
feat: Implement admin panel with the ability to change role of users
Diffstat (limited to 'models/user.php')
-rw-r--r--models/user.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/models/user.php b/models/user.php
index 71cf07d..6ff2f70 100644
--- a/models/user.php
+++ b/models/user.php
@@ -60,16 +60,18 @@ class User extends Table {
private static $AnonUID = 1;
- function update(string $Username, string $Password = null) {
+ function update(string $Username = null, string $Password = null, string $Role = null) {
// Applicable to Anon user
if ($this->Password === '') {
throw new Exception('Not modifying system account!');
}
+ $Username = $Username ?? $this->Username;
$Password = ($Password === null) ? $this->Password : password_hash($Password, PASSWORD_BCRYPT);
+ $Role = $Role ?? $this->Role;
Table::_update(
'Users',
- "Username = \"$Username\", Password = \"$Password\"",
+ "Username = \"$Username\", Password = \"$Password\", Role = \"$Role\"",
"UID = \"$this->UID\""
);
}