2024-02-13 02:08:24 +01:00
|
|
|
import {realm} from "./state_data";
|
2024-02-16 22:56:36 +01:00
|
|
|
import type {GroupPermissionSetting} from "./state_data";
|
2023-04-06 09:26:48 +02:00
|
|
|
|
|
|
|
export function get_group_permission_setting_config(
|
|
|
|
setting_name: string,
|
2023-10-31 04:36:05 +01:00
|
|
|
setting_type: "realm" | "stream" | "group",
|
2023-04-06 09:26:48 +02:00
|
|
|
): GroupPermissionSetting | undefined {
|
2024-02-13 02:08:24 +01:00
|
|
|
const permission_settings_dict = realm.server_supported_permission_settings;
|
2023-10-31 04:36:05 +01:00
|
|
|
|
|
|
|
const permission_config_dict = permission_settings_dict[setting_type][setting_name];
|
|
|
|
|
2023-04-06 09:26:48 +02:00
|
|
|
if (!permission_config_dict) {
|
|
|
|
throw new Error(`Invalid setting: ${setting_name}`);
|
|
|
|
}
|
|
|
|
return permission_config_dict;
|
|
|
|
}
|