blob: 868f3852401430f6a7443baa2dacbd4bca19c43c (
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
37
38
|
<?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;
#[Unique] public ?string $pendingEmail;
public ?\DateTimeImmutable $pendingEmailCreated;
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;
}
}
|