aee9c9f82e
The button is only shown if the user has any of the management permissions.
90 lines
1.6 KiB
Dart
90 lines
1.6 KiB
Dart
// 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 {
|
|
static int get none {
|
|
return oB("0000000000000000");
|
|
}
|
|
|
|
// default permission set
|
|
static int get def {
|
|
return oB("0000000000000011");
|
|
}
|
|
|
|
static int get canUseAPI {
|
|
return oB("0000000000000001");
|
|
}
|
|
|
|
static int get provideCert {
|
|
return oB("0000000000000010");
|
|
}
|
|
|
|
static int get manageOTA {
|
|
return oB("0000010000000000");
|
|
}
|
|
|
|
static int get manageServerProductList {
|
|
return oB("0000100000000000");
|
|
}
|
|
|
|
static int get viewUsersAndLists {
|
|
return oB("0001000000000000");
|
|
}
|
|
|
|
static int get editSettings {
|
|
return oB("0010000000000000");
|
|
}
|
|
|
|
static int get editPermissions {
|
|
return oB("0100000000000000");
|
|
}
|
|
|
|
static int get editUsers {
|
|
return oB("1000000000000000");
|
|
}
|
|
|
|
static int get allManagement {
|
|
return oB("1111110000000000");
|
|
}
|
|
|
|
static int get all {
|
|
return oB("1111111111111111");
|
|
}
|
|
}
|
|
|
|
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");
|
|
}
|
|
}
|