fix
This commit is contained in:
parent
2d00909eef
commit
6230dc5927
@ -1,4 +1,4 @@
|
||||
namespace ASC.ActiveDirectory;
|
||||
namespace ASC.ActiveDirectory.Base;
|
||||
public class ActiveDirectoryDbContext : BaseDbContext
|
||||
{
|
||||
public DbSet<DbTenant> Tenants { get; set; }
|
@ -67,7 +67,7 @@ public class LdapNotifyHelper
|
||||
var source = new LdapNotifySource(tenant, this);
|
||||
var client = WorkContext.NotifyContext.NotifyService.RegisterClient(source, scope);
|
||||
WorkContext.RegisterSendMethod(source.AutoSync, cron);
|
||||
_clients.Add(tenant.TenantId, new Tuple<INotifyClient, LdapNotifySource>(client, source)); //concurrent dict
|
||||
_clients.Add(tenant.TenantId, new Tuple<INotifyClient, LdapNotifySource>(client, source));
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ public class LdapNotifyHelper
|
||||
public void AutoSync(Tenant tenant)
|
||||
{
|
||||
using var scope = _serviceProvider.CreateScope();
|
||||
var settingsManager = scope.ServiceProvider.GetService<SettingsManager>();
|
||||
var settingsManager = scope.ServiceProvider.GetRequiredService<SettingsManager>();
|
||||
var ldapSettings = settingsManager.LoadForTenant<LdapSettings>(tenant.TenantId);
|
||||
|
||||
if (!ldapSettings.EnableLdapAuthentication)
|
||||
@ -96,7 +96,7 @@ public class LdapNotifyHelper
|
||||
return;
|
||||
}
|
||||
|
||||
var op = scope.ServiceProvider.GetService<LdapSaveSyncOperation>();
|
||||
var op = scope.ServiceProvider.GetRequiredService<LdapSaveSyncOperation>();
|
||||
|
||||
op.Init(ldapSettings, tenant, LdapOperationType.Sync);
|
||||
_ldapTasks.QueueTask(op.RunJob, op.GetDistributedTask());
|
||||
|
@ -101,12 +101,12 @@ public abstract class LdapOperation
|
||||
public void RunJob(DistributedTask _, CancellationToken cancellationToken)
|
||||
{
|
||||
using var scope = _serviceProvider.CreateScope();
|
||||
TenantManager = scope.ServiceProvider.GetService<TenantManager>();
|
||||
_securityContext = scope.ServiceProvider.GetService<SecurityContext>();
|
||||
LDAPUserManager = scope.ServiceProvider.GetService<LdapUserManager>();
|
||||
TenantManager = scope.ServiceProvider.GetRequiredService<TenantManager>();
|
||||
_securityContext = scope.ServiceProvider.GetRequiredService<SecurityContext>();
|
||||
LDAPUserManager = scope.ServiceProvider.GetRequiredService<LdapUserManager>();
|
||||
LDAPUserManager.Init(Resource);
|
||||
_novellLdapHelper = scope.ServiceProvider.GetService<NovellLdapHelper>();
|
||||
Importer = scope.ServiceProvider.GetService<NovellLdapUserImporter>();
|
||||
_novellLdapHelper = scope.ServiceProvider.GetRequiredService<NovellLdapHelper>();
|
||||
Importer = scope.ServiceProvider.GetRequiredService<NovellLdapUserImporter>();
|
||||
|
||||
try
|
||||
{
|
||||
@ -150,7 +150,7 @@ public abstract class LdapOperation
|
||||
|
||||
if (LDAPSettings.EnableLdapAuthentication)
|
||||
{
|
||||
var ldapSettingsChecker = scope.ServiceProvider.GetService<NovellLdapSettingsChecker>();
|
||||
var ldapSettingsChecker = scope.ServiceProvider.GetRequiredService<NovellLdapSettingsChecker>();
|
||||
ldapSettingsChecker.Init(Importer);
|
||||
|
||||
SetProgress(5, Resource.LdapSettingsStatusLoadingBaseInfo);
|
||||
|
@ -49,7 +49,7 @@ public class LdapSaveSyncOperation : LdapOperation
|
||||
string userId = null)
|
||||
{
|
||||
using var scope = _serviceProvider.CreateScope();
|
||||
var userManager = _serviceProvider.GetService<UserManager>();
|
||||
var userManager = _serviceProvider.GetRequiredService<UserManager>();
|
||||
_currentUser = userId != null ? userManager.GetUsers(Guid.Parse(userId)) : null;
|
||||
base.Init(settings, tenant, operation, resource);
|
||||
}
|
||||
@ -57,15 +57,15 @@ public class LdapSaveSyncOperation : LdapOperation
|
||||
protected override void Do()
|
||||
{
|
||||
using var scope = _serviceProvider.CreateScope();
|
||||
_ldapChanges = scope.ServiceProvider.GetService<LdapChangeCollection>();
|
||||
_ldapChanges = scope.ServiceProvider.GetRequiredService<LdapChangeCollection>();
|
||||
_ldapChanges.Tenant = CurrentTenant;
|
||||
_userFormatter = scope.ServiceProvider.GetService<UserFormatter>();
|
||||
_settingsManager = scope.ServiceProvider.GetService<SettingsManager>();
|
||||
_userPhotoManager = scope.ServiceProvider.GetService<UserPhotoManager>();
|
||||
_webItemSecurity = scope.ServiceProvider.GetService<WebItemSecurity>();
|
||||
_userManager = scope.ServiceProvider.GetService<UserManager>();
|
||||
_displayUserSettingsHelper = scope.ServiceProvider.GetService<DisplayUserSettingsHelper>();
|
||||
_tenantManager = scope.ServiceProvider.GetService<TenantManager>();
|
||||
_userFormatter = scope.ServiceProvider.GetRequiredService<UserFormatter>();
|
||||
_settingsManager = scope.ServiceProvider.GetRequiredService<SettingsManager>();
|
||||
_userPhotoManager = scope.ServiceProvider.GetRequiredService<UserPhotoManager>();
|
||||
_webItemSecurity = scope.ServiceProvider.GetRequiredService<WebItemSecurity>();
|
||||
_userManager = scope.ServiceProvider.GetRequiredService<UserManager>();
|
||||
_displayUserSettingsHelper = scope.ServiceProvider.GetRequiredService<DisplayUserSettingsHelper>();
|
||||
_tenantManager = scope.ServiceProvider.GetRequiredService<TenantManager>();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -618,12 +618,12 @@ public class LdapUserManager
|
||||
new Task(() =>
|
||||
{
|
||||
using var scope = _serviceProvider.CreateScope();
|
||||
var tenantManager = scope.ServiceProvider.GetService<TenantManager>();
|
||||
var securityContext = scope.ServiceProvider.GetService<SecurityContext>();
|
||||
var novellLdapUserImporter = scope.ServiceProvider.GetService<NovellLdapUserImporter>();
|
||||
var userManager = scope.ServiceProvider.GetService<UserManager>();
|
||||
var cookiesManager = scope.ServiceProvider.GetService<CookiesManager>();
|
||||
var log = scope.ServiceProvider.GetService<IOptionsMonitor<ILog>>().Get("ASC");
|
||||
var tenantManager = scope.ServiceProvider.GetRequiredService<TenantManager>();
|
||||
var securityContext = scope.ServiceProvider.GetRequiredService<SecurityContext>();
|
||||
var novellLdapUserImporter = scope.ServiceProvider.GetRequiredService<NovellLdapUserImporter>();
|
||||
var userManager = scope.ServiceProvider.GetRequiredService<UserManager>();
|
||||
var cookiesManager = scope.ServiceProvider.GetRequiredService<CookiesManager>();
|
||||
var log = scope.ServiceProvider.GetRequiredService<IOptionsMonitor<ILog>>().Get("ASC");
|
||||
|
||||
tenantManager.SetCurrentTenant(tenant);
|
||||
securityContext.AuthenticateMe(Core.Configuration.Constants.CoreSystem);
|
||||
|
@ -137,7 +137,7 @@ public class NovellLdapHelper : LdapHelper
|
||||
public override void CheckCredentials(string login, string password, string server, int portNumber,
|
||||
bool startTls, bool ssl, bool acceptCertificate, string acceptCertificateHash)
|
||||
{
|
||||
using var novellLdapSearcher = _serviceProvider.GetService<NovellLdapSearcher>();
|
||||
using var novellLdapSearcher = _serviceProvider.GetRequiredService<NovellLdapSearcher>();
|
||||
novellLdapSearcher.Init(login, password, server, portNumber, startTls, ssl, acceptCertificate, acceptCertificateHash);
|
||||
novellLdapSearcher.Connect();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user