feat: LdapOptions erstellt anstelle statischer (fest codierter) Konfigurationswerte, LdapOptions und Abhängigkeitsinjektionen dafür hinzugefügt
This commit is contained in:
@@ -12,8 +12,11 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeToWebAppRepository : BaseRepository<EmployeeToWebApp>
|
||||
{
|
||||
public EmployeeToWebAppRepository(WebApiContext context) : base(context)
|
||||
private readonly LdapManager _ldapManager;
|
||||
|
||||
public EmployeeToWebAppRepository(WebApiContext context, LdapManager ldapManager) : base(context)
|
||||
{
|
||||
_ldapManager = ldapManager;
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteEmloyeeToWebAppAsync(int webAppId)
|
||||
@@ -75,24 +78,24 @@ namespace DAL.Repositories
|
||||
if (department != default && !string.IsNullOrEmpty(department.AdGroupDepartmentName))
|
||||
{
|
||||
groupSuffix = $"{webapp.AdWebAppName}_{department.AdGroupDepartmentName}";
|
||||
if (LdapManager.IsWindreamSuffixGroup(groupSuffix))
|
||||
if (_ldapManager.IsWindreamSuffixGroup(groupSuffix))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (webappRole != default)
|
||||
{
|
||||
groupSuffix = $"{webapp.AdWebAppName}_{webappRole.WebAppRoleName}";
|
||||
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);
|
||||
|
||||
if (LdapManager.IsWindreamAdminGroup(groupSuffix))
|
||||
if (_ldapManager.IsWindreamAdminGroup(groupSuffix))
|
||||
{
|
||||
groupSuffix = $"{webapp.AdWebAppName}_User";
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user