summaryrefslogtreecommitdiff
path: root/src/application/mystic/forum/orm/User.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/application/mystic/forum/orm/User.php')
-rw-r--r--src/application/mystic/forum/orm/User.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/application/mystic/forum/orm/User.php b/src/application/mystic/forum/orm/User.php
index 3b531b4..1db1d04 100644
--- a/src/application/mystic/forum/orm/User.php
+++ b/src/application/mystic/forum/orm/User.php
@@ -5,13 +5,27 @@ namespace mystic\forum\orm;
use mystic\forum\attributes\PrimaryKey;
use mystic\forum\attributes\Table;
+use mystic\forum\attributes\Unique;
#[Table("public.users")]
class User extends Entity {
+ public const SUPERUSER_ID = "SUPERUSER";
+
#[PrimaryKey]
public string $id;
- public string $name;
+ #[Unique] public string $name;
public string $displayName;
+ #[Unique] public string $email;
public \DateTimeImmutable $created;
public string $passwordHash;
+ public int $permissionMask;
+ public bool $passwordResetRequired;
+ public string $activationToken;
+ public bool $activated;
+
+ public function hasPermission(int $perm): bool {
+ if ($this->id === self::SUPERUSER_ID)
+ return true;
+ return ($this->permissionMask & $perm) === $perm;
+ }
}