summaryrefslogtreecommitdiff
path: root/src/application/mystic/forum/orm/UserPermissions.php
blob: 47af076c6a45eb019171036b0404fffd7a10907b (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
declare(strict_types=1);

namespace mystic\forum\orm;

use mystic\forum\utils\StaticClass;

final class UserPermissions {
    use StaticClass;

    public const CREATE_OWN_POST = 0x01;
    public const EDIT_OWN_POST = 0x02;
    public const DELETE_OWN_POST = 0x04;

    public const CREATE_OWN_TOPIC = 0x08;
    public const EDIT_OWN_TOPIC = 0x10;
    public const DELETE_OWN_TOPIC = 0x20;

    public const CREATE_OWN_ATTACHMENT = 0x40;
    public const EDIT_OWN_ATTACHMENT = 0x80;
    public const DELETE_OWN_ATTACHMENT = 0x100;

    // public const CREATE_OWN_USER = n/a;
    public const EDIT_OWN_USER = 0x200;
    public const DELETE_OWN_USER = 0x400;
    
    // public const CREATE_OTHER_POST = n/a;
    public const EDIT_OTHER_POST = 0x800;
    public const DELETE_OTHER_POST = 0x1000;

    public const CREATE_OTHER_USER = 0x2000;
    public const EDIT_OTHER_USER = 0x4000;
    public const DELETE_OTHER_USER = 0x8000;

    public const DELETE_OTHER_TOPIC = 0x10000;
    public const EDIT_OTHER_TOPIC = 0x20000;

    ////////

    public const GROUP_USER = self::CREATE_OWN_POST
                            | self::EDIT_OWN_POST
                            | self::DELETE_OWN_POST
                            | self::CREATE_OWN_TOPIC
                            | self::EDIT_OWN_TOPIC
                            | self::DELETE_OWN_TOPIC
                            | self::CREATE_OWN_ATTACHMENT
                            | self::EDIT_OWN_ATTACHMENT
                            | self::DELETE_OWN_ATTACHMENT
                            | self::EDIT_OWN_USER
                            | self::DELETE_OWN_USER;
    
    public const GROUP_MOD = self::GROUP_USER
                           | self::EDIT_OTHER_POST
                           | self::DELETE_OTHER_USER
                           | self::DELETE_OTHER_TOPIC
                           | self::EDIT_OTHER_TOPIC;

    public const GROUP_ADMIN = self::GROUP_MOD
                             | self::CREATE_OTHER_USER
                             | self::EDIT_OTHER_USER
                             | self::DELETE_OTHER_USER;
}