| 3877 | } |
| 3878 | |
| 3879 | fn materialize_global_settings( |
| 3880 | global: &StoredSettings, |
| 3881 | ) -> Result<HashMap<String, SettingValue>, Status> { |
| 3882 | let mut materialized = HashMap::new(); |
| 3883 | for registered in settings::REGISTERED_SETTINGS { |
| 3884 | materialized.insert(registered.key.to_string(), SettingValue { value: None }); |
| 3885 | } |
| 3886 | |
| 3887 | for (key, value) in &global.settings { |
| 3888 | if key == POLICY_SETTING_KEY { |
| 3889 | continue; |
| 3890 | } |
| 3891 | if settings::setting_for_key(key).is_none() { |
| 3892 | continue; |
| 3893 | } |
| 3894 | materialized.insert(key.clone(), stored_setting_to_proto(value)?); |
| 3895 | } |
| 3896 | |
| 3897 | Ok(materialized) |
| 3898 | } |
| 3899 | |
| 3900 | // --------------------------------------------------------------------------- |
| 3901 | // Tests |