mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 21:27:21 +00:00
Added a home page prompt for missing API keys of enterprise providers (#1056)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
1f8d72aa45
commit
7d35536c87
29 files changed
+920
-31
No files matched your search
@@ -306,10 +306,23 @@ public sealed class EnterpriseEnvironmentService(ILogger<EnterpriseEnvironmentSe
|
||||
{
|
||||
foreach (var secret in secrets)
|
||||
{
|
||||
if (!secret.IsEnterpriseConfiguration || secret.EnterpriseConfigurationPluginId == Guid.Empty)
|
||||
if (!HoldsSecretOfTheOrganization(secret))
|
||||
continue;
|
||||
|
||||
secretTargets.Add(new EnterpriseSecretTarget(secret.SecretId, secret.SecretName, storeType));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the secret of a configuration object came with the configuration of the organization, so that it
|
||||
/// goes when the organization changes its encryption secret.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A provider which allows the API key of the user holds the key the user entered, not one of the organization.
|
||||
/// The new encryption secret does not concern that key, and the configuration brings none to replace it.
|
||||
/// Hence, the key stays, just as it stays when the organization withdraws the provider.
|
||||
/// </remarks>
|
||||
/// <param name="configObject">The configuration object which holds a secret.</param>
|
||||
/// <returns>True, when the secret has to go along with the old encryption secret.</returns>
|
||||
internal static bool HoldsSecretOfTheOrganization(IConfigurationObject configObject) => configObject.IsEnterpriseConfiguration && configObject.EnterpriseConfigurationPluginId != Guid.Empty && configObject is not IUserProvidedAPIKey { AllowUserProvidedAPIKey: true };
|
||||
}
|
||||
Reference in new issue
Block a user