mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 19:52:10 +00:00
Replaced the per-setting left-over checks with a generic sweep over all registered managed settings
This commit is contained in:
parent
33721e6c56
commit
6355c91ac6
@ -113,12 +113,12 @@ Plugins can configure:
|
|||||||
- etc.
|
- etc.
|
||||||
|
|
||||||
Configuration plugins provide three kinds of values:
|
Configuration plugins provide three kinds of values:
|
||||||
- **Managed settings:** simple values such as booleans, numbers, strings, enums, lists, or sets handled through `ManagedConfiguration`. These values may be locked or used as organization defaults.
|
- **Managed settings:** simple values such as booleans, numbers, strings, enums, lists, or sets handled through `ManagedConfiguration`. These values may be locked or used as organization defaults. Which configuration plugin owns a locked setting is persisted in `Data.ManagedLockedConfigurations`, and organization defaults are tracked in `Data.ManagedEditableDefaults`. Both are cleaned up generically by `ManagedConfiguration.CleanupLeftOverManagedConfigurations(...)` when the owning plugin is gone.
|
||||||
- **Managed configuration objects:** complex Lua tables that are persisted into `SettingsManager.ConfigurationData`, implement `IConfigurationObject`, and are cleaned up through `PluginConfigurationObject.CleanLeftOverConfigurationObjects(...)`. Examples include providers, profiles, chat templates, data sources, and document analysis policies.
|
- **Managed configuration objects:** complex Lua tables that are persisted into `SettingsManager.ConfigurationData`, implement `IConfigurationObject`, and are cleaned up through `PluginConfigurationObject.CleanLeftOverConfigurationObjects(...)`. Examples include providers, profiles, chat templates, data sources, and document analysis policies.
|
||||||
- **Live plugin content:** complex Lua tables that implement `ILivePluginContent` and are read live from running plugins instead of being persisted to `ConfigurationData`. Examples include `MANDATORY_INFOS` and `INTRODUCTIONS`. If live plugin content creates persistent side data, add a dedicated cleanup path for that side data, like mandatory-info acceptances.
|
- **Live plugin content:** complex Lua tables that implement `ILivePluginContent` and are read live from running plugins instead of being persisted to `ConfigurationData`. Examples include `MANDATORY_INFOS` and `INTRODUCTIONS`. If live plugin content creates persistent side data, add a dedicated cleanup path for that side data, like mandatory-info acceptances.
|
||||||
|
|
||||||
When adding configuration plugin capabilities:
|
When adding configuration plugin capabilities:
|
||||||
- For managed settings, update the corresponding data class in `app/MindWork AI Studio/Settings/DataModel/` to call `ManagedConfiguration.Register(...)`, process the setting in `PluginConfiguration.TryProcessConfiguration`, and check for leftover managed configuration in `PluginFactory.Loading.LoadAll`.
|
- For managed settings, update the corresponding data class in `app/MindWork AI Studio/Settings/DataModel/` to call `ManagedConfiguration.Register(...)` and process the setting in `PluginConfiguration.TryProcessConfiguration`. Cleaning up the setting when its configuration plugin was removed needs no extra step: `ManagedConfiguration.CleanupLeftOverManagedConfigurations(...)` iterates all registered settings. Do not add per-setting cleanup calls to `PluginFactory.Loading.LoadAll`.
|
||||||
- For managed configuration objects, update `PluginConfigurationObject.cs` and `PluginConfigurationObjectType.cs`, persist them in the appropriate `ConfigurationData` collection, and add cleanup via `PluginConfigurationObject.CleanLeftOverConfigurationObjects(...)`.
|
- For managed configuration objects, update `PluginConfigurationObject.cs` and `PluginConfigurationObjectType.cs`, persist them in the appropriate `ConfigurationData` collection, and add cleanup via `PluginConfigurationObject.CleanLeftOverConfigurationObjects(...)`.
|
||||||
- For live plugin content, add a data type implementing `ILivePluginContent`, parse it in `PluginConfiguration`, expose it through `PluginFactory`, and add any required cleanup only for persistent side data.
|
- For live plugin content, add a data type implementing `ILivePluginContent`, parse it in `PluginConfiguration`, expose it through `PluginFactory`, and add any required cleanup only for persistent side data.
|
||||||
- Always document the new capability in `app/MindWork AI Studio/Plugins/configuration/plugin.lua`.
|
- Always document the new capability in `app/MindWork AI Studio/Plugins/configuration/plugin.lua`.
|
||||||
|
|||||||
@ -924,8 +924,8 @@ public static partial class ManagedConfiguration
|
|||||||
// case only when the setting was locked and managed by the same configuration plugin.
|
// case only when the setting was locked and managed by the same configuration plugin.
|
||||||
//
|
//
|
||||||
// The other case, when the setting was locked and managed by a different configuration plugin,
|
// The other case, when the setting was locked and managed by a different configuration plugin,
|
||||||
// is handled by the IsConfigurationLeftOver method, which checks if the configuration plugin
|
// is handled by the CleanupLeftOverManagedConfigurations method, which checks if the configuration
|
||||||
// is still available. If it is not available, it resets the locked state of the
|
// plugin is still available. If it is not available, it resets the locked state of the
|
||||||
// configuration setting, allowing it to be reconfigured by a different plugin or left unchanged.
|
// configuration setting, allowing it to be reconfigured by a different plugin or left unchanged.
|
||||||
//
|
//
|
||||||
configMeta.ResetLockedConfiguration();
|
configMeta.ResetLockedConfiguration();
|
||||||
|
|||||||
@ -19,10 +19,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
|
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
|
||||||
/// <returns>The default value.</returns>
|
/// <returns>The default value.</returns>
|
||||||
public static TValue Register<TClass, TValue>(
|
public static TValue Register<TClass, TValue>(Expression<Func<Data, TClass>>? configSelection, Expression<Func<TClass, TValue>> propertyExpression, TValue defaultValue)
|
||||||
Expression<Func<Data, TClass>>? configSelection,
|
|
||||||
Expression<Func<TClass, TValue>> propertyExpression,
|
|
||||||
TValue defaultValue)
|
|
||||||
where TValue : struct
|
where TValue : struct
|
||||||
{
|
{
|
||||||
// When called from the JSON deserializer by using the standard constructor,
|
// When called from the JSON deserializer by using the standard constructor,
|
||||||
@ -57,10 +54,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <param name="defaultValue">The default value to use when the setting is not configured.</param>
|
/// <param name="defaultValue">The default value to use when the setting is not configured.</param>
|
||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <returns>The default value.</returns>
|
/// <returns>The default value.</returns>
|
||||||
public static string Register<TClass>(
|
public static string Register<TClass>(Expression<Func<Data, TClass>>? configSelection, Expression<Func<TClass, string>> propertyExpression, string defaultValue)
|
||||||
Expression<Func<Data, TClass>>? configSelection,
|
|
||||||
Expression<Func<TClass, string>> propertyExpression,
|
|
||||||
string defaultValue)
|
|
||||||
{
|
{
|
||||||
// When called from the JSON deserializer by using the standard constructor,
|
// When called from the JSON deserializer by using the standard constructor,
|
||||||
// we ignore the register call and return the default value:
|
// we ignore the register call and return the default value:
|
||||||
@ -95,10 +89,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <typeparam name="TValue">The type of the elements in the list within the configuration class.</typeparam>
|
/// <typeparam name="TValue">The type of the elements in the list within the configuration class.</typeparam>
|
||||||
/// <returns>A list containing the default value.</returns>
|
/// <returns>A list containing the default value.</returns>
|
||||||
public static List<TValue> Register<TClass, TValue>(
|
public static List<TValue> Register<TClass, TValue>(Expression<Func<Data, TClass>>? configSelection, Expression<Func<TClass, IList<TValue>>> propertyExpression, TValue defaultValue)
|
||||||
Expression<Func<Data, TClass>>? configSelection,
|
|
||||||
Expression<Func<TClass, IList<TValue>>> propertyExpression,
|
|
||||||
TValue defaultValue)
|
|
||||||
{
|
{
|
||||||
// When called from the JSON deserializer by using the standard constructor,
|
// When called from the JSON deserializer by using the standard constructor,
|
||||||
// we ignore the register call and return the default value:
|
// we ignore the register call and return the default value:
|
||||||
@ -133,10 +124,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <typeparam name="TValue">The type of the elements within the property list.</typeparam>
|
/// <typeparam name="TValue">The type of the elements within the property list.</typeparam>
|
||||||
/// <returns>The list of default values.</returns>
|
/// <returns>The list of default values.</returns>
|
||||||
public static List<TValue> Register<TClass, TValue>(
|
public static List<TValue> Register<TClass, TValue>(Expression<Func<Data, TClass>>? configSelection, Expression<Func<TClass, IList<TValue>>> propertyExpression, IList<TValue> defaultValues)
|
||||||
Expression<Func<Data, TClass>>? configSelection,
|
|
||||||
Expression<Func<TClass, IList<TValue>>> propertyExpression,
|
|
||||||
IList<TValue> defaultValues)
|
|
||||||
{
|
{
|
||||||
// When called from the JSON deserializer by using the standard constructor,
|
// When called from the JSON deserializer by using the standard constructor,
|
||||||
// we ignore the register call and return the default value:
|
// we ignore the register call and return the default value:
|
||||||
@ -170,10 +158,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <typeparam name="TValue">The type of the values within the set.</typeparam>
|
/// <typeparam name="TValue">The type of the values within the set.</typeparam>
|
||||||
/// <returns>A set containing the default value.</returns>
|
/// <returns>A set containing the default value.</returns>
|
||||||
public static HashSet<TValue> Register<TClass, TValue>(
|
public static HashSet<TValue> Register<TClass, TValue>(Expression<Func<Data, TClass>>? configSelection, Expression<Func<TClass, ISet<TValue>>> propertyExpression, TValue defaultValue)
|
||||||
Expression<Func<Data, TClass>>? configSelection,
|
|
||||||
Expression<Func<TClass, ISet<TValue>>> propertyExpression,
|
|
||||||
TValue defaultValue)
|
|
||||||
{
|
{
|
||||||
// When called from the JSON deserializer by using the standard constructor,
|
// When called from the JSON deserializer by using the standard constructor,
|
||||||
// we ignore the register call and return the default value:
|
// we ignore the register call and return the default value:
|
||||||
@ -208,10 +193,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TClass">The type of the configuration class from which the property is selected.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class from which the property is selected.</typeparam>
|
||||||
/// <typeparam name="TValue">The type of the elements in the collection associated with the configuration property.</typeparam>
|
/// <typeparam name="TValue">The type of the elements in the collection associated with the configuration property.</typeparam>
|
||||||
/// <returns>A set containing the default values.</returns>
|
/// <returns>A set containing the default values.</returns>
|
||||||
public static HashSet<TValue> Register<TClass, TValue>(
|
public static HashSet<TValue> Register<TClass, TValue>(Expression<Func<Data, TClass>>? configSelection, Expression<Func<TClass, ISet<TValue>>> propertyExpression, IList<TValue> defaultValues)
|
||||||
Expression<Func<Data, TClass>>? configSelection,
|
|
||||||
Expression<Func<TClass, ISet<TValue>>> propertyExpression,
|
|
||||||
IList<TValue> defaultValues)
|
|
||||||
{
|
{
|
||||||
// When called from the JSON deserializer by using the standard constructor,
|
// When called from the JSON deserializer by using the standard constructor,
|
||||||
// we ignore the register call and return the default value:
|
// we ignore the register call and return the default value:
|
||||||
@ -246,10 +228,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TClass">The type of the configuration class from which the property is selected.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class from which the property is selected.</typeparam>
|
||||||
/// <typeparam name="TDict">>The type of the dictionary within the configuration class.</typeparam>
|
/// <typeparam name="TDict">>The type of the dictionary within the configuration class.</typeparam>
|
||||||
/// <returns>A dictionary containing the default values.</returns>
|
/// <returns>A dictionary containing the default values.</returns>
|
||||||
public static TDict Register<TClass, TDict>(
|
public static TDict Register<TClass, TDict>(Expression<Func<Data, TClass>>? configSelection, Expression<Func<TClass, IDictionary<string, string>>> propertyExpression, TDict defaultValues)
|
||||||
Expression<Func<Data, TClass>>? configSelection,
|
|
||||||
Expression<Func<TClass, IDictionary<string, string>>> propertyExpression,
|
|
||||||
TDict defaultValues)
|
|
||||||
where TDict : IDictionary<string, string>, new()
|
where TDict : IDictionary<string, string>, new()
|
||||||
{
|
{
|
||||||
// When called from the JSON deserializer by using the standard constructor,
|
// When called from the JSON deserializer by using the standard constructor,
|
||||||
@ -286,10 +265,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TKey">The enum type of the dictionary keys.</typeparam>
|
/// <typeparam name="TKey">The enum type of the dictionary keys.</typeparam>
|
||||||
/// <typeparam name="TValue">The enum type of the dictionary values.</typeparam>
|
/// <typeparam name="TValue">The enum type of the dictionary values.</typeparam>
|
||||||
/// <returns>A dictionary containing the default values.</returns>
|
/// <returns>A dictionary containing the default values.</returns>
|
||||||
public static Dictionary<TKey, TValue> Register<TClass, TKey, TValue>(
|
public static Dictionary<TKey, TValue> Register<TClass, TKey, TValue>(Expression<Func<Data, TClass>>? configSelection, Expression<Func<TClass, Dictionary<TKey, TValue>>> propertyExpression, Dictionary<TKey, TValue> defaultValues)
|
||||||
Expression<Func<Data, TClass>>? configSelection,
|
|
||||||
Expression<Func<TClass, Dictionary<TKey, TValue>>> propertyExpression,
|
|
||||||
Dictionary<TKey, TValue> defaultValues)
|
|
||||||
where TKey : struct, Enum
|
where TKey : struct, Enum
|
||||||
where TValue : struct, Enum
|
where TValue : struct, Enum
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,8 +9,11 @@ namespace AIStudio.Settings;
|
|||||||
public static partial class ManagedConfiguration
|
public static partial class ManagedConfiguration
|
||||||
{
|
{
|
||||||
private static readonly ConcurrentDictionary<string, IConfig> METADATA = new();
|
private static readonly ConcurrentDictionary<string, IConfig> METADATA = new();
|
||||||
|
|
||||||
private static SettingsManager SettingsManagerAccess => Program.SERVICE_PROVIDER.GetRequiredService<SettingsManager>();
|
private static SettingsManager SettingsManagerAccess => Program.SERVICE_PROVIDER.GetRequiredService<SettingsManager>();
|
||||||
|
|
||||||
|
private static ILogger Log => Program.LOGGER_FACTORY.CreateLogger(nameof(ManagedConfiguration));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to retrieve the configuration metadata for a given configuration selection and
|
/// Attempts to retrieve the configuration metadata for a given configuration selection and
|
||||||
/// property expression (enum-based).
|
/// property expression (enum-based).
|
||||||
@ -28,10 +31,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
|
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
|
||||||
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
||||||
public static bool TryGet<TClass, TValue>(
|
public static bool TryGet<TClass, TValue>(Expression<Func<Data, TClass>> configSelection, Expression<Func<TClass, TValue>> propertyExpression, out ConfigMeta<TClass, TValue> configMeta)
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, TValue>> propertyExpression,
|
|
||||||
out ConfigMeta<TClass, TValue> configMeta)
|
|
||||||
where TValue : Enum
|
where TValue : Enum
|
||||||
{
|
{
|
||||||
var configPath = Path(configSelection, propertyExpression);
|
var configPath = Path(configSelection, propertyExpression);
|
||||||
@ -66,10 +66,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// if found.</param>
|
/// if found.</param>
|
||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
||||||
public static bool TryGet<TClass>(
|
public static bool TryGet<TClass>(Expression<Func<Data, TClass>> configSelection, Expression<Func<TClass, string>> propertyExpression, out ConfigMeta<TClass, string> configMeta)
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, string>> propertyExpression,
|
|
||||||
out ConfigMeta<TClass, string> configMeta)
|
|
||||||
{
|
{
|
||||||
var configPath = Path(configSelection, propertyExpression);
|
var configPath = Path(configSelection, propertyExpression);
|
||||||
if (METADATA.TryGetValue(configPath, out var value) && value is ConfigMeta<TClass, string> meta)
|
if (METADATA.TryGetValue(configPath, out var value) && value is ConfigMeta<TClass, string> meta)
|
||||||
@ -106,11 +103,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
||||||
|
|
||||||
// ReSharper disable MethodOverloadWithOptionalParameter
|
// ReSharper disable MethodOverloadWithOptionalParameter
|
||||||
public static bool TryGet<TClass, TValue>(
|
public static bool TryGet<TClass, TValue>(Expression<Func<Data, TClass>> configSelection, Expression<Func<TClass, TValue>> propertyExpression, out ConfigMeta<TClass, TValue> configMeta, ISpanParsable<TValue>? _ = null)
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, TValue>> propertyExpression,
|
|
||||||
out ConfigMeta<TClass, TValue> configMeta,
|
|
||||||
ISpanParsable<TValue>? _ = null)
|
|
||||||
where TValue : struct, ISpanParsable<TValue>
|
where TValue : struct, ISpanParsable<TValue>
|
||||||
{
|
{
|
||||||
var configPath = Path(configSelection, propertyExpression);
|
var configPath = Path(configSelection, propertyExpression);
|
||||||
@ -146,10 +139,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
|
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
|
||||||
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
||||||
public static bool TryGet<TClass, TValue>(
|
public static bool TryGet<TClass, TValue>(Expression<Func<Data, TClass>> configSelection, Expression<Func<TClass, IList<TValue>>> propertyExpression, out ConfigMeta<TClass, IList<TValue>> configMeta)
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, IList<TValue>>> propertyExpression,
|
|
||||||
out ConfigMeta<TClass, IList<TValue>> configMeta)
|
|
||||||
{
|
{
|
||||||
var configPath = Path(configSelection, propertyExpression);
|
var configPath = Path(configSelection, propertyExpression);
|
||||||
if (METADATA.TryGetValue(configPath, out var value) && value is ConfigMeta<TClass, IList<TValue>> meta)
|
if (METADATA.TryGetValue(configPath, out var value) && value is ConfigMeta<TClass, IList<TValue>> meta)
|
||||||
@ -182,10 +172,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
|
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
|
||||||
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
||||||
public static bool TryGet<TClass, TValue>(
|
public static bool TryGet<TClass, TValue>(Expression<Func<Data, TClass>> configSelection, Expression<Func<TClass, ISet<TValue>>> propertyExpression, out ConfigMeta<TClass, ISet<TValue>> configMeta)
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, ISet<TValue>>> propertyExpression,
|
|
||||||
out ConfigMeta<TClass, ISet<TValue>> configMeta)
|
|
||||||
{
|
{
|
||||||
var configPath = Path(configSelection, propertyExpression);
|
var configPath = Path(configSelection, propertyExpression);
|
||||||
if (METADATA.TryGetValue(configPath, out var value) && value is ConfigMeta<TClass, ISet<TValue>> meta)
|
if (METADATA.TryGetValue(configPath, out var value) && value is ConfigMeta<TClass, ISet<TValue>> meta)
|
||||||
@ -217,10 +204,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// if found.</param>
|
/// if found.</param>
|
||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
||||||
public static bool TryGet<TClass>(
|
public static bool TryGet<TClass>(Expression<Func<Data, TClass>> configSelection, Expression<Func<TClass, IDictionary<string, string>>> propertyExpression, out ConfigMeta<TClass, IDictionary<string, string>> configMeta)
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, IDictionary<string, string>>> propertyExpression,
|
|
||||||
out ConfigMeta<TClass, IDictionary<string, string>> configMeta)
|
|
||||||
{
|
{
|
||||||
var configPath = Path(configSelection, propertyExpression);
|
var configPath = Path(configSelection, propertyExpression);
|
||||||
if (METADATA.TryGetValue(configPath, out var value) && value is ConfigMeta<TClass, IDictionary<string, string>> meta)
|
if (METADATA.TryGetValue(configPath, out var value) && value is ConfigMeta<TClass, IDictionary<string, string>> meta)
|
||||||
@ -254,10 +238,7 @@ public static partial class ManagedConfiguration
|
|||||||
/// <typeparam name="TKey">The enum type of the dictionary keys.</typeparam>
|
/// <typeparam name="TKey">The enum type of the dictionary keys.</typeparam>
|
||||||
/// <typeparam name="TValue">The enum type of the dictionary values.</typeparam>
|
/// <typeparam name="TValue">The enum type of the dictionary values.</typeparam>
|
||||||
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
/// <returns>True if the configuration metadata was found, otherwise false.</returns>
|
||||||
public static bool TryGet<TClass, TKey, TValue>(
|
public static bool TryGet<TClass, TKey, TValue>(Expression<Func<Data, TClass>> configSelection, Expression<Func<TClass, Dictionary<TKey, TValue>>> propertyExpression, out ConfigMeta<TClass, Dictionary<TKey, TValue>> configMeta)
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, Dictionary<TKey, TValue>>> propertyExpression,
|
|
||||||
out ConfigMeta<TClass, Dictionary<TKey, TValue>> configMeta)
|
|
||||||
where TKey : struct, Enum
|
where TKey : struct, Enum
|
||||||
where TValue : struct, Enum
|
where TValue : struct, Enum
|
||||||
{
|
{
|
||||||
@ -277,209 +258,92 @@ public static partial class ManagedConfiguration
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if a configuration setting is left over from a configuration plugin that is no longer available.
|
/// Removes all managed states whose configuration plugin is not available anymore.
|
||||||
/// If the configuration setting is locked and managed by a configuration plugin that is not available,
|
|
||||||
/// it resets the managed state of the configuration setting and returns true.
|
|
||||||
/// Otherwise, it returns false.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="configSelection">The expression to select the configuration class.</param>
|
/// <remarks>
|
||||||
/// <param name="propertyExpression">The expression to select the property within the configuration class.</param>
|
/// This covers every registered setting, regardless of its type: locked settings, editable
|
||||||
|
/// defaults, and additive plugin contributions. Settings do not need to be listed anywhere for
|
||||||
|
/// this cleanup to work, so adding a new managed setting cannot be forgotten here.<br/><br/>
|
||||||
|
/// A locked setting whose plugin is gone is reset to its default value. That is intended: the
|
||||||
|
/// value belonged to the organization, not to the user, and the user might not be able to
|
||||||
|
/// change it at all.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="availablePlugins">The collection of available plugins to check against.</param>
|
/// <param name="availablePlugins">The collection of available plugins to check against.</param>
|
||||||
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
/// <returns>True when at least one setting was changed, otherwise false.</returns>
|
||||||
/// <typeparam name="TValue">The type of the property within the configuration class.</typeparam>
|
public static bool CleanupLeftOverManagedConfigurations(IReadOnlyCollection<IAvailablePlugin> availablePlugins)
|
||||||
/// <returns>True if the configuration setting is left over and was reset, otherwise false.</returns>
|
|
||||||
public static bool IsConfigurationLeftOver<TClass, TValue>(
|
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, TValue>> propertyExpression,
|
|
||||||
IReadOnlyList<IAvailablePlugin> availablePlugins)
|
|
||||||
where TValue : Enum
|
|
||||||
{
|
{
|
||||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
var wasChanged = false;
|
||||||
return false;
|
var registeredSettingNames = new HashSet<string>(StringComparer.Ordinal);
|
||||||
|
|
||||||
if (configMeta.LockedByConfigPluginId != Guid.Empty && configMeta.IsLocked)
|
foreach (var config in METADATA.Values)
|
||||||
{
|
{
|
||||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
if (config is not ConfigMetaBase configMeta)
|
||||||
if (plugin is null)
|
continue;
|
||||||
|
|
||||||
|
registeredSettingNames.Add(configMeta.SettingName);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Restore the persisted ownership first. Otherwise, we would not recognize a left-over
|
||||||
|
// lock when nobody has read this setting since the settings were loaded:
|
||||||
|
//
|
||||||
|
configMeta.RestoreLockedConfiguration();
|
||||||
|
|
||||||
|
// Check the locked state:
|
||||||
|
if (configMeta.IsLocked && configMeta.LockedByConfigPluginId != Guid.Empty && !IsPluginAvailable(configMeta.LockedByConfigPluginId, availablePlugins))
|
||||||
{
|
{
|
||||||
|
Log.LogInformation($"Resetting the setting '{configMeta.SettingName}': it was locked by the configuration plugin '{configMeta.LockedByConfigPluginId}', which is not available anymore.");
|
||||||
configMeta.ResetLockedConfiguration();
|
configMeta.ResetLockedConfiguration();
|
||||||
return true;
|
wasChanged = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return CleanupEditableDefaultState(configMeta, SettingName(propertyExpression), availablePlugins);
|
// Check the editable default state:
|
||||||
}
|
if (CleanupEditableDefaultState(configMeta, availablePlugins))
|
||||||
|
wasChanged = true;
|
||||||
|
|
||||||
public static bool IsConfigurationLeftOver<TClass>(
|
// Check the additive plugin contribution:
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
if (configMeta.HasPluginContribution && configMeta.PluginContributionByConfigPluginId != Guid.Empty && !IsPluginAvailable(configMeta.PluginContributionByConfigPluginId, availablePlugins))
|
||||||
Expression<Func<TClass, string>> propertyExpression,
|
|
||||||
IReadOnlyList<IAvailablePlugin> availablePlugins)
|
|
||||||
{
|
{
|
||||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
Log.LogInformation($"Clearing the plugin contribution for the setting '{configMeta.SettingName}': the configuration plugin '{configMeta.PluginContributionByConfigPluginId}' is not available anymore.");
|
||||||
return false;
|
configMeta.ClearPluginContribution();
|
||||||
|
wasChanged = true;
|
||||||
if (configMeta.LockedByConfigPluginId != Guid.Empty && configMeta.IsLocked)
|
|
||||||
{
|
|
||||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
|
||||||
if (plugin is null)
|
|
||||||
{
|
|
||||||
configMeta.ResetLockedConfiguration();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CleanupEditableDefaultState(configMeta, SettingName(propertyExpression), availablePlugins);
|
// Remove persisted states which belong to settings that do not exist anymore:
|
||||||
|
if (RemoveUnknownManagedStates(registeredSettingNames))
|
||||||
|
wasChanged = true;
|
||||||
|
|
||||||
|
return wasChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable MethodOverloadWithOptionalParameter
|
private static bool IsPluginAvailable(Guid configPluginId, IReadOnlyCollection<IAvailablePlugin> availablePlugins) => availablePlugins.Any(x => x.Id == configPluginId);
|
||||||
public static bool IsConfigurationLeftOver<TClass, TValue>(
|
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, TValue>> propertyExpression,
|
|
||||||
IReadOnlyList<IAvailablePlugin> availablePlugins,
|
|
||||||
ISpanParsable<TValue>? _ = null)
|
|
||||||
where TValue : struct, ISpanParsable<TValue>
|
|
||||||
{
|
|
||||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (configMeta.LockedByConfigPluginId != Guid.Empty && configMeta.IsLocked)
|
|
||||||
{
|
|
||||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
|
||||||
if (plugin is null)
|
|
||||||
{
|
|
||||||
configMeta.ResetLockedConfiguration();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return CleanupEditableDefaultState(configMeta, SettingName(propertyExpression), availablePlugins);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReSharper restore MethodOverloadWithOptionalParameter
|
|
||||||
|
|
||||||
public static bool IsConfigurationLeftOver<TClass, TValue>(
|
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, IList<TValue>>> propertyExpression,
|
|
||||||
IEnumerable<IAvailablePlugin> availablePlugins)
|
|
||||||
{
|
|
||||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (configMeta.ManagedMode is ManagedConfigurationMode.EDITABLE_DEFAULT)
|
|
||||||
return CleanupEditableDefaultState(configMeta, SettingName(propertyExpression), availablePlugins.ToList());
|
|
||||||
|
|
||||||
if (configMeta.LockedByConfigPluginId == Guid.Empty || !configMeta.IsLocked)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
|
||||||
if (plugin is not null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
configMeta.ResetLockedConfiguration();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsConfigurationLeftOver<TClass, TValue>(
|
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, ISet<TValue>>> propertyExpression,
|
|
||||||
IEnumerable<IAvailablePlugin> availablePlugins)
|
|
||||||
{
|
|
||||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (configMeta.LockedByConfigPluginId == Guid.Empty || !configMeta.IsLocked)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
|
||||||
if (plugin is null)
|
|
||||||
{
|
|
||||||
configMeta.ResetLockedConfiguration();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if a plugin contribution is left over from a configuration plugin that is no longer available.
|
/// Removes persisted managed states which belong to settings that are not registered anymore.
|
||||||
/// If so, it clears the contribution and returns true.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool IsPluginContributionLeftOver<TClass, TValue>(
|
/// <remarks>
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
/// Without this, states of removed or renamed settings would stay in the settings file forever.
|
||||||
Expression<Func<TClass, ISet<TValue>>> propertyExpression,
|
/// </remarks>
|
||||||
IEnumerable<IAvailablePlugin> availablePlugins)
|
private static bool RemoveUnknownManagedStates(IReadOnlySet<string> registeredSettingNames)
|
||||||
{
|
{
|
||||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
var wasChanged = false;
|
||||||
return false;
|
var configurationData = SettingsManagerAccess.ConfigurationData;
|
||||||
|
|
||||||
if (!configMeta.HasPluginContribution || configMeta.PluginContributionByConfigPluginId == Guid.Empty)
|
foreach (var settingName in configurationData.ManagedLockedConfigurations.Keys.Where(x => !registeredSettingNames.Contains(x)).ToList())
|
||||||
return false;
|
|
||||||
|
|
||||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.PluginContributionByConfigPluginId);
|
|
||||||
if (plugin is null)
|
|
||||||
{
|
{
|
||||||
configMeta.ClearPluginContribution();
|
Log.LogInformation($"Removing the persisted lock of the setting '{settingName}': this setting does not exist anymore.");
|
||||||
return true;
|
configurationData.ManagedLockedConfigurations.Remove(settingName);
|
||||||
|
wasChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
foreach (var settingName in configurationData.ManagedEditableDefaults.Keys.Where(x => !registeredSettingNames.Contains(x)).ToList())
|
||||||
|
{
|
||||||
|
Log.LogInformation($"Removing the persisted editable default of the setting '{settingName}': this setting does not exist anymore.");
|
||||||
|
configurationData.ManagedEditableDefaults.Remove(settingName);
|
||||||
|
wasChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsConfigurationLeftOver<TClass>(
|
return wasChanged;
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, IDictionary<string, string>>> propertyExpression,
|
|
||||||
IEnumerable<IAvailablePlugin> availablePlugins)
|
|
||||||
{
|
|
||||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (configMeta.LockedByConfigPluginId == Guid.Empty || !configMeta.IsLocked)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
|
||||||
if (plugin is null)
|
|
||||||
{
|
|
||||||
configMeta.ResetLockedConfiguration();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsConfigurationLeftOver<TClass, TKey, TValue>(
|
|
||||||
Expression<Func<Data, TClass>> configSelection,
|
|
||||||
Expression<Func<TClass, Dictionary<TKey, TValue>>> propertyExpression,
|
|
||||||
IEnumerable<IAvailablePlugin> availablePlugins)
|
|
||||||
where TKey : struct, Enum
|
|
||||||
where TValue : struct, Enum
|
|
||||||
{
|
|
||||||
if (!TryGet(configSelection, propertyExpression, out var configMeta))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (configMeta.ManagedMode is ManagedConfigurationMode.EDITABLE_DEFAULT)
|
|
||||||
{
|
|
||||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.EditableDefaultByConfigPluginId);
|
|
||||||
if (plugin is null)
|
|
||||||
{
|
|
||||||
configMeta.ClearEditableDefaultConfiguration();
|
|
||||||
ClearEditableDefaultState(SettingName(propertyExpression));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configMeta.LockedByConfigPluginId == Guid.Empty || !configMeta.IsLocked)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var lockedPlugin = availablePlugins.FirstOrDefault(x => x.Id == configMeta.LockedByConfigPluginId);
|
|
||||||
if (lockedPlugin is null)
|
|
||||||
{
|
|
||||||
configMeta.ResetLockedConfiguration();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string Path<TClass, TValue>(Expression<Func<Data, TClass>> configSelection, Expression<Func<TClass, TValue>> propertyExpression)
|
private static string Path<TClass, TValue>(Expression<Func<Data, TClass>> configSelection, Expression<Func<TClass, TValue>> propertyExpression)
|
||||||
@ -514,12 +378,9 @@ public static partial class ManagedConfiguration
|
|||||||
|
|
||||||
private static bool ClearEditableDefaultState(string settingName) => SettingsManagerAccess.ConfigurationData.ManagedEditableDefaults.Remove(settingName);
|
private static bool ClearEditableDefaultState(string settingName) => SettingsManagerAccess.ConfigurationData.ManagedEditableDefaults.Remove(settingName);
|
||||||
|
|
||||||
private static bool CleanupEditableDefaultState<TClass, TValue>(
|
private static bool CleanupEditableDefaultState(ConfigMetaBase configMeta, IReadOnlyCollection<IAvailablePlugin> availablePlugins)
|
||||||
ConfigMeta<TClass, TValue> configMeta,
|
|
||||||
string settingName,
|
|
||||||
IReadOnlyList<IAvailablePlugin> availablePlugins)
|
|
||||||
{
|
{
|
||||||
if (!TryGetEditableDefaultState(settingName, out var editableDefaultState))
|
if (!TryGetEditableDefaultState(configMeta.SettingName, out var editableDefaultState))
|
||||||
{
|
{
|
||||||
if (configMeta.ManagedMode is not ManagedConfigurationMode.EDITABLE_DEFAULT)
|
if (configMeta.ManagedMode is not ManagedConfigurationMode.EDITABLE_DEFAULT)
|
||||||
return false;
|
return false;
|
||||||
@ -528,11 +389,11 @@ public static partial class ManagedConfiguration
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var plugin = availablePlugins.FirstOrDefault(x => x.Id == editableDefaultState.ConfigPluginId);
|
if (IsPluginAvailable(editableDefaultState.ConfigPluginId, availablePlugins))
|
||||||
if (plugin is not null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Log.LogInformation($"Clearing the editable default of the setting '{configMeta.SettingName}': the configuration plugin '{editableDefaultState.ConfigPluginId}' is not available anymore.");
|
||||||
configMeta.ClearEditableDefaultConfiguration();
|
configMeta.ClearEditableDefaultConfiguration();
|
||||||
return ClearEditableDefaultState(settingName);
|
return ClearEditableDefaultState(configMeta.SettingName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,185 +199,9 @@ public static partial class PluginFactory
|
|||||||
if (SettingsManagerAccess.ConfigurationData.MandatoryInformation.RemoveLeftOverAcceptances(GetMandatoryInfos()))
|
if (SettingsManagerAccess.ConfigurationData.MandatoryInformation.RemoveLeftOverAcceptances(GetMandatoryInfos()))
|
||||||
wasConfigurationChanged = true;
|
wasConfigurationChanged = true;
|
||||||
|
|
||||||
// Check for a preselected provider:
|
// Check all managed settings, i.e. settings which a configuration plugin can lock,
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.PreselectedProvider, AVAILABLE_PLUGINS))
|
// provide as an editable default, or contribute to:
|
||||||
wasConfigurationChanged = true;
|
if(ManagedConfiguration.CleanupLeftOverManagedConfigurations(AVAILABLE_PLUGINS))
|
||||||
|
|
||||||
// Check for a preselected profile:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.PreselectedProfile, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for preselected chat options:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Chat, x => x.PreselectOptions, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Chat, x => x.PreselectedProvider, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Chat, x => x.PreselectedProfile, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Chat, x => x.PreselectedChatTemplate, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Chat, x => x.PreselectedDataSourcesDisabled, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Chat, x => x.PreselectedDataSourcesAutomaticSelection, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Chat, x => x.PreselectedDataSourcesAutomaticValidation, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Chat, x => x.PreselectedDataSourceIds, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Chat, x => x.SendToChatDataSourceBehavior, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the update interval:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.UpdateInterval, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the update installation method:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.UpdateInstallation, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the start page:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.StartPage, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the built-in introduction visibility:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.ShowIntroduction, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the quick start guide visibility:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.ShowQuickStartGuide, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the last changelog visibility:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.ShowLastChangelog, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the vision panel visibility:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.ShowVision, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for users allowed to added providers:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.AllowUserToAddProvider, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the plugin import permission:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.AllowUserToImportPlugins, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the plugin sharing permission:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.AllowUserToSharePlugins, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for admin settings visibility:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.ShowAdminSettings, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for preview visibility:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.PreviewVisibility, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for enabled preview features:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.EnabledPreviewFeatures, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsPluginContributionLeftOver(x => x.App, x => x.EnabledPreviewFeatures, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the transcription provider:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.UseTranscriptionProvider, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for hidden assistants:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.HiddenAssistants, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the voice recording shortcut:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.ShortcutVoiceRecording, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for the external HTTP client timeout:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.HttpClientTimeoutSeconds, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check for custom root certificates for external HTTP requests:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.ExternalHttpCustomRootCertificatesEnabled, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.ExternalHttpCustomRootCertificateBundlePath, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.App, x => x.ExternalHttpCustomRootCertificateAllowedHosts, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check provider confidence settings:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Confidence, x => x.EnforceGlobalMinimumConfidence, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Confidence, x => x.GlobalMinimumConfidence, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Confidence, x => x.ShowProviderConfidence, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Confidence, x => x.ConfidenceScheme, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.Confidence, x => x.CustomConfidenceScheme, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check data source security settings:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.DataSourceSecurity, x => x.TrustedProviderIds, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check data source selection agent settings:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AgentDataSourceSelection, x => x.PreselectAgentOptions, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AgentDataSourceSelection, x => x.PreselectedAgentProvider, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check retrieval context validation agent settings:
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AgentRetrievalContextValidation, x => x.EnableRetrievalContextValidation, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AgentRetrievalContextValidation, x => x.PreselectAgentOptions, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AgentRetrievalContextValidation, x => x.PreselectedAgentProvider, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AgentRetrievalContextValidation, x => x.NumParallelValidations, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check if audit is required before it can be activated
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AssistantPluginAudit, x => x.RequireAuditBeforeActivation, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Register new preselected provider for the security audit
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AssistantPluginAudit, x => x.PreselectedAgentProvider, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Change the minimum required audit level that is required for the allowance of assistants
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AssistantPluginAudit, x => x.MinimumLevel, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check if external plugins are strictly forbidden, when the minimum audit level is fell below
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AssistantPluginAudit, x => x.BlockActivationBelowMinimum, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check if security audits are invoked automatically and transparent for the user
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AssistantPluginAudit, x => x.AutomaticallyAuditAssistants, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
|
||||||
|
|
||||||
// Check enterprise-managed assistant plugin approvals
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AssistantPluginAudit, x => x.EnterpriseApprovedPlugins, AVAILABLE_PLUGINS))
|
|
||||||
wasConfigurationChanged = true;
|
wasConfigurationChanged = true;
|
||||||
|
|
||||||
// Compatibility shim, see documentation/compatibility-shims/2026-08-orphaned-config-locks.md (remove after 2027-08-06):
|
// Compatibility shim, see documentation/compatibility-shims/2026-08-orphaned-config-locks.md (remove after 2027-08-06):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user