blob: 1bf02f1d018206d5dcee5ae59d942b95fdb23b85 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
declare(strict_types=1);
namespace mystic\forum\orm;
use mystic\forum\attributes\Column;
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;
#[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;
#[Unique] public ?string $passwordResetToken;
public ?\DateTimeImmutable $passwordResetTokenCreated;
#[Column(columnType: "bytea")] public ?string $profilePicture;
public ?\DateTimeImmutable $nameLastChanged;
public function hasPermission(int $perm): bool {
if ($this->id === self::SUPERUSER_ID)
return true;
return ($this->permissionMask & $perm) === $perm;
}
}
|