2023-04-06 09:26:48 +02:00
|
|
|
type GroupPermissionSetting = {
|
|
|
|
require_system_group: boolean;
|
|
|
|
allow_internet_group: boolean;
|
|
|
|
allow_owners_group: boolean;
|
|
|
|
allow_nobody_group: boolean;
|
2023-09-07 02:06:51 +02:00
|
|
|
allow_everyone_group: boolean;
|
2023-04-06 09:26:48 +02:00
|
|
|
};
|
|
|
|
|
2023-04-19 23:44:37 +02:00
|
|
|
const group_permission_config_dict = new Map<string, GroupPermissionSetting>([
|
2023-04-06 09:26:48 +02:00
|
|
|
[
|
|
|
|
"can_remove_subscribers_group",
|
|
|
|
{
|
|
|
|
require_system_group: true,
|
|
|
|
allow_internet_group: false,
|
|
|
|
allow_owners_group: false,
|
|
|
|
allow_nobody_group: false,
|
2023-09-07 02:06:51 +02:00
|
|
|
allow_everyone_group: true,
|
2023-04-06 09:26:48 +02:00
|
|
|
},
|
|
|
|
],
|
2023-08-03 16:06:40 +02:00
|
|
|
[
|
|
|
|
"create_multiuse_invite_group",
|
|
|
|
{
|
|
|
|
require_system_group: true,
|
|
|
|
allow_internet_group: false,
|
|
|
|
allow_owners_group: false,
|
|
|
|
allow_nobody_group: true,
|
2023-09-07 02:06:51 +02:00
|
|
|
allow_everyone_group: false,
|
2023-08-03 16:06:40 +02:00
|
|
|
},
|
|
|
|
],
|
2023-04-06 09:26:48 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
export function get_group_permission_setting_config(
|
|
|
|
setting_name: string,
|
|
|
|
): GroupPermissionSetting | undefined {
|
|
|
|
const permission_config_dict = group_permission_config_dict.get(setting_name);
|
|
|
|
if (!permission_config_dict) {
|
|
|
|
throw new Error(`Invalid setting: ${setting_name}`);
|
|
|
|
}
|
|
|
|
return permission_config_dict;
|
|
|
|
}
|