mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-08-21 04:12:56 +00:00
Add method to remove enterprise config ID
This commit is contained in:
parent
03bf288844
commit
944f4a836e
@ -22,6 +22,30 @@ public sealed partial class RustService
|
|||||||
return configurationId;
|
return configurationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tries to read the enterprise environment for a configuration ID, which must be removed.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Removing a configuration ID is necessary when the user moved to another department or
|
||||||
|
/// left the company, or when the configuration ID is no longer valid.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>
|
||||||
|
/// Returns the empty Guid when the environment is not set or the request fails.
|
||||||
|
/// Otherwise, the configuration ID.
|
||||||
|
/// </returns>
|
||||||
|
public async Task<Guid> EnterpriseEnvRemoveConfigId()
|
||||||
|
{
|
||||||
|
var result = await this.http.DeleteAsync("/system/enterprise/config/id");
|
||||||
|
if (!result.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
this.logger!.LogError($"Failed to query the enterprise configuration ID for removal: '{result.StatusCode}'");
|
||||||
|
return Guid.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
Guid.TryParse(await result.Content.ReadAsStringAsync(), out var configurationId);
|
||||||
|
return configurationId;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to read the enterprise environment for the current user's configuration server URL.
|
/// Tries to read the enterprise environment for the current user's configuration server URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -29,16 +53,16 @@ public sealed partial class RustService
|
|||||||
/// Returns null when the environment is not set or the request fails.
|
/// Returns null when the environment is not set or the request fails.
|
||||||
/// Otherwise, the configuration server URL.
|
/// Otherwise, the configuration server URL.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async Task<string?> EnterpriseEnvConfigServerUrl()
|
public async Task<string> EnterpriseEnvConfigServerUrl()
|
||||||
{
|
{
|
||||||
var result = await this.http.GetAsync("/system/enterprise/config/server");
|
var result = await this.http.GetAsync("/system/enterprise/config/server");
|
||||||
if (!result.IsSuccessStatusCode)
|
if (!result.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
this.logger!.LogError($"Failed to query the enterprise configuration server URL: '{result.StatusCode}'");
|
this.logger!.LogError($"Failed to query the enterprise configuration server URL: '{result.StatusCode}'");
|
||||||
return null;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
var serverUrl = await result.Content.ReadAsStringAsync();
|
var serverUrl = await result.Content.ReadAsStringAsync();
|
||||||
return string.IsNullOrWhiteSpace(serverUrl) ? null : serverUrl;
|
return string.IsNullOrWhiteSpace(serverUrl) ? string.Empty : serverUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user