[backend/core] Fix policy configuration endpoint not working
This commit is contained in:
parent
dc77c48005
commit
96e2eff2b9
1 changed files with 2 additions and 10 deletions
|
@ -97,16 +97,8 @@ public class PolicyService(IServiceScopeFactory scopeFactory)
|
|||
{
|
||||
var type = await GetConfigurationType(name);
|
||||
if (type == null) return null;
|
||||
|
||||
var cType = _policyConfigurationTypes
|
||||
.FirstOrDefault(p => p.GetInterfaces()
|
||||
.FirstOrDefault(i => i.Name == typeof(IPolicyConfiguration<>).Name)
|
||||
?.GenericTypeArguments.FirstOrDefault() ==
|
||||
type);
|
||||
|
||||
if (cType == null) return null;
|
||||
if (data == null) return (IPolicyConfiguration?)Activator.CreateInstance(cType);
|
||||
return (IPolicyConfiguration?)JsonSerializer.Deserialize(data, cType);
|
||||
if (data == null) return (IPolicyConfiguration?)Activator.CreateInstance(type);
|
||||
return (IPolicyConfiguration?)JsonSerializer.Deserialize(data, type);
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetAvailablePolicies()
|
||||
|
|
Loading…
Add table
Reference in a new issue