feat: LdapOptions erstellt anstelle statischer (fest codierter) Konfigurationswerte, LdapOptions und Abhängigkeitsinjektionen dafür hinzugefügt

This commit is contained in:
Developer 02
2024-08-05 14:31:59 +02:00
parent d434a5964b
commit eedc726440
6 changed files with 69 additions and 72 deletions

View File

@@ -12,8 +12,11 @@ namespace DAL.Repositories
{
public class WebAppToDepartmentRepository : BaseRepository<WebAppToDepartment>
{
public WebAppToDepartmentRepository(WebApiContext context) : base(context)
private readonly LdapManager _ldapManager;
public WebAppToDepartmentRepository(WebApiContext context, LdapManager ldapManager) : base(context)
{
_ldapManager = ldapManager;
}
public async Task<List<WebAppToDepartment>> GetListByFilterAsync(EmployeeToWebAppFilter filter, bool asNoTracking = true)
@@ -59,11 +62,11 @@ namespace DAL.Repositories
var isAdding = action == "adding";
var groupSuffix = $"{webapp.AdWebAppName}_{department.AdGroupDepartmentName}";
if (!LdapManager.IsWindreamSuffixGroup(groupSuffix)) return true;
if (!_ldapManager.IsWindreamSuffixGroup(groupSuffix)) return true;
try
{
if (isAdding) result = LdapManager.AD_AddUserloginToGroup(employee.LoginName, groupSuffix);
else result = LdapManager.AD_RemoveUserFromGroup(employee.LoginName, groupSuffix);
if (isAdding) result = _ldapManager.AD_AddUserloginToGroup(employee.LoginName, groupSuffix);
else result = _ldapManager.AD_RemoveUserFromGroup(employee.LoginName, groupSuffix);
}
catch (Exception ex)
{