summaryrefslogtreecommitdiff
path: root/src/application/mystic/forum/orm/UserPermissions.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/application/mystic/forum/orm/UserPermissions.php')
-rw-r--r--src/application/mystic/forum/orm/UserPermissions.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/application/mystic/forum/orm/UserPermissions.php b/src/application/mystic/forum/orm/UserPermissions.php
new file mode 100644
index 0000000..cd2fdf4
--- /dev/null
+++ b/src/application/mystic/forum/orm/UserPermissions.php
@@ -0,0 +1,59 @@
+<?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 GROUP_USER = self::CREATE_OWN_POST
+ | self::EDIT_OWN_POST
+ | self::DELETE_OWN_POST
+ | self::CREATE_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;
+
+ public const GROUP_ADMIN = self::GROUP_MOD
+ | self::CREATE_OTHER_USER
+ | self::EDIT_OTHER_USER
+ | self::DELETE_OTHER_USER;
+}