-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroles.py
More file actions
48 lines (44 loc) · 1.26 KB
/
roles.py
File metadata and controls
48 lines (44 loc) · 1.26 KB
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
class Role:
def __init__(self):
self.permissions = set()
def has_permission(self, permission: str) -> bool:
return permission in self.permissions
class SuperAdmin(Role):
def __init__(self):
super().__init__()
self.permissions = {
"register_channel",
"set_admin",
"set_registrator",
"link_channel",
"unlink_channel",
"remove_channel_registration",
"set_registrator",
"remove_admin",
"remove_registrator",
"can't_be_admin",
"can't_be_registrator",
"superadmin_only",
"admin_only"
}
class Admin(Role):
def __init__(self):
super().__init__()
self.permissions = {
"register_channel",
"set_registrator",
"link_channel",
"unlink_channel",
"remove_channel_registration",
"set_registrator",
"remove_registrator",
"can't_be_registrator",
"admin_only"
}
class Registrator(Role):
def __init__(self):
super().__init__()
self.permissions = {
"register_channel",
"link_channel"
}