diff options
author | Jonas Kohl | 2024-09-12 19:49:17 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-09-12 19:49:17 +0200 |
commit | 086e2d2668784469ec114f6e6fd2b3dace3d7c3b (patch) | |
tree | b9bacedb713501d88d24085940267a7c94e69b29 /src/application/mystic/forum/orm/User.php | |
parent | 34b1b391d4b03659a96f868857c230002b351514 (diff) |
Way more progress on forum
Diffstat (limited to 'src/application/mystic/forum/orm/User.php')
-rw-r--r-- | src/application/mystic/forum/orm/User.php | 16 |
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; + } } |