Implemented room permission types
Done in preperations for rooms, and the ability to edit rooms. Will later be used to hide/show certain elements, when the user does not meet the criteria (permissions / admin / owner)
This commit is contained in:
parent
69d1892fc8
commit
48c15b244a
1 changed files with 41 additions and 0 deletions
41
lib/backend/permissions.dart
Normal file
41
lib/backend/permissions.dart
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// implementation of permission types
|
||||||
|
// according to the server permissions.ts
|
||||||
|
// https://codeberg.org/outbag/server/src/branch/dev/src/server/permissions.ts
|
||||||
|
|
||||||
|
// same as javascript 0b prefix
|
||||||
|
// pronounced o-b
|
||||||
|
int oB(String binary) {
|
||||||
|
return int.parse(binary, radix: 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
class ServerPermission {}
|
||||||
|
|
||||||
|
class RoomPermission {
|
||||||
|
static int get addArticles {
|
||||||
|
return oB("0000001");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get removeArticles {
|
||||||
|
return oB("0000010");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get listGroupsItems {
|
||||||
|
return oB("0000100");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get changeMeta {
|
||||||
|
return oB("0001000");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get ota {
|
||||||
|
return oB("0010000");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get changeAdmin {
|
||||||
|
return oB("0100000");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get manageMembers {
|
||||||
|
return oB("1000000");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue