protected override void CheckIndexEntry() { if (base.IndexEntry != null) { RequestJobObjectId requestJobId = base.IndexEntry.GetRequestJobId(); if (requestJobId == null || requestJobId.RequestGuid == Guid.Empty || requestJobId.MdbGuid == Guid.Empty) { this.requestCondition = RemoveRequest <TIdentity> .RequestCondition.IndexEntryMissingData; this.brokenIndexEntry = base.IndexEntry; base.IndexEntry = null; } } }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); try { if (base.ParameterSetName.Equals("Identity")) { TIdentity identity = this.Identity; if (identity.OrganizationId != null) { IDirectorySession dataSession = this.recipSession; TIdentity identity2 = this.Identity; if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(dataSession, identity2.OrganizationId)) { IDirectorySession session = this.recipSession; TIdentity identity3 = this.Identity; this.recipSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(session, identity3.OrganizationId, true); } IDirectorySession dataSession2 = this.currentOrgConfigSession; TIdentity identity4 = this.Identity; if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(dataSession2, identity4.OrganizationId)) { IDirectorySession session2 = this.currentOrgConfigSession; TIdentity identity5 = this.Identity; this.currentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(session2, identity5.OrganizationId, true); this.rjProvider.IndexProvider.ConfigSession = this.currentOrgConfigSession; } } ADUser aduser = null; TIdentity identity6 = this.Identity; if (!string.IsNullOrEmpty(identity6.MailboxName)) { IRecipientSession dataSession3 = this.recipSession; IRecipientSession globalCatalogSession = this.gcSession; ADServerSettings serverSettings = base.ServerSettings; TIdentity identity7 = this.Identity; aduser = RequestTaskHelper.ResolveADUser(dataSession3, globalCatalogSession, serverSettings, new MailboxOrMailUserIdParameter(identity7.MailboxName), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), false); if (aduser != null) { TIdentity identity8 = this.Identity; identity8.MailboxId = aduser.Id; if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.recipSession, aduser)) { this.recipSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.recipSession, aduser.OrganizationId, true); } if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.currentOrgConfigSession, aduser)) { this.currentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.currentOrgConfigSession, aduser.OrganizationId, true); this.rjProvider.IndexProvider.ConfigSession = this.currentOrgConfigSession; } } } TIdentity identity9 = this.Identity; if (!string.IsNullOrEmpty(identity9.OrganizationName)) { IConfigurationSession configurationSession = RequestTaskHelper.CreateOrganizationFindingSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId); TIdentity identity10 = this.Identity; IIdentityParameter id = new OrganizationIdParameter(identity10.OrganizationName); IConfigDataProvider session3 = configurationSession; ObjectId rootID = null; TIdentity identity11 = this.Identity; LocalizedString? notFoundError = new LocalizedString?(Strings.ErrorOrganizationNotFound(identity11.OrganizationName)); TIdentity identity12 = this.Identity; ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(id, session3, rootID, notFoundError, new LocalizedString?(Strings.ErrorOrganizationNotUnique(identity12.OrganizationName))); if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.recipSession, adorganizationalUnit)) { this.recipSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.recipSession, adorganizationalUnit.OrganizationId, true); } if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.currentOrgConfigSession, adorganizationalUnit)) { this.currentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.currentOrgConfigSession, adorganizationalUnit.OrganizationId, true); this.rjProvider.IndexProvider.ConfigSession = this.currentOrgConfigSession; } } TIdentity identity13 = this.Identity; identity13.SetDefaultIndex(this.DefaultRequestIndexId); IRequestIndexEntry entry = this.GetEntry(); RequestJobObjectId requestJobId = entry.GetRequestJobId(); if (entry.TargetUserId != null) { if (aduser != null && aduser.Id.Equals(entry.TargetUserId)) { requestJobId.TargetUser = aduser; } else { requestJobId.TargetUser = RequestTaskHelper.ResolveADUser(this.recipSession, this.gcSession, base.ServerSettings, new MailboxOrMailUserIdParameter(entry.TargetUserId), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), false); } } if (entry.SourceUserId != null) { if (aduser != null && aduser.Id.Equals(entry.SourceUserId)) { requestJobId.SourceUser = aduser; } else { requestJobId.SourceUser = RequestTaskHelper.ResolveADUser(this.recipSession, this.gcSession, base.ServerSettings, new MailboxOrMailUserIdParameter(entry.SourceUserId), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), false); } } this.CheckIndexEntry(entry); TDataObject tdataObject = (TDataObject)((object)this.rjProvider.Read <TDataObject>(requestJobId)); if (tdataObject == null || tdataObject.Status == RequestStatus.None) { TIdentity identity14 = this.Identity; base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorCouldNotFindRequest(identity14.ToString())), ErrorCategory.InvalidArgument, this.Identity); } else if (tdataObject.RequestType != this.RequestType) { base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorNotEnoughInformationToFindRequest), ErrorCategory.InvalidArgument, this.Identity); } else { this.WriteResult(tdataObject); } } else if (base.ParameterSetName.Equals("MigrationRequestQueue")) { if (this.RequestQueue != null) { MailboxDatabase mailboxDatabase = (MailboxDatabase)base.GetDataObject <MailboxDatabase>(this.RequestQueue, this.configSession, null, new LocalizedString?(Strings.ErrorMailboxDatabaseNotFound(this.RequestQueue.ToString())), new LocalizedString?(Strings.ErrorMailboxDatabaseNotUnique(this.RequestQueue.ToString()))); this.fromMdb = mailboxDatabase.Id; } this.rjProvider.AllowInvalid = true; base.InternalProcessRecord(); } } finally { TaskLogger.LogExit(); } }
protected override IConfigurable PrepareDataObject() { TIdentity identity = this.Identity; if (identity.OrganizationId != null) { IDirectorySession writeableSession = this.WriteableSession; TIdentity identity2 = this.Identity; if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(writeableSession, identity2.OrganizationId)) { IDirectorySession writeableSession2 = this.WriteableSession; TIdentity identity3 = this.Identity; this.WriteableSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(writeableSession2, identity3.OrganizationId, true); } IDirectorySession currentOrgConfigSession = this.CurrentOrgConfigSession; TIdentity identity4 = this.Identity; if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(currentOrgConfigSession, identity4.OrganizationId)) { IDirectorySession currentOrgConfigSession2 = this.CurrentOrgConfigSession; TIdentity identity5 = this.Identity; this.CurrentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(currentOrgConfigSession2, identity5.OrganizationId, true); this.RJProvider.IndexProvider.ConfigSession = this.CurrentOrgConfigSession; } } TIdentity identity6 = this.Identity; if (!string.IsNullOrEmpty(identity6.MailboxName)) { IRecipientSession writeableSession3 = this.WriteableSession; IRecipientSession gcsession = this.GCSession; ADServerSettings serverSettings = base.ServerSettings; TIdentity identity7 = this.Identity; ADUser aduser = RequestTaskHelper.ResolveADUser(writeableSession3, gcsession, serverSettings, new UserIdParameter(identity7.MailboxName), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true); if (aduser != null) { TIdentity identity8 = this.Identity; identity8.MailboxId = aduser.Id; if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.WriteableSession, aduser)) { this.WriteableSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.WriteableSession, aduser.OrganizationId, true); } if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.CurrentOrgConfigSession, aduser)) { this.CurrentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.CurrentOrgConfigSession, aduser.OrganizationId, true); this.RJProvider.IndexProvider.ConfigSession = this.CurrentOrgConfigSession; } } } TIdentity identity9 = this.Identity; if (!string.IsNullOrEmpty(identity9.OrganizationName)) { IConfigurationSession configurationSession = RequestTaskHelper.CreateOrganizationFindingSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId); TIdentity identity10 = this.Identity; IIdentityParameter id = new OrganizationIdParameter(identity10.OrganizationName); IConfigDataProvider session = configurationSession; ObjectId rootID = null; TIdentity identity11 = this.Identity; LocalizedString? notFoundError = new LocalizedString?(Strings.ErrorOrganizationNotFound(identity11.OrganizationName)); TIdentity identity12 = this.Identity; ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(id, session, rootID, notFoundError, new LocalizedString?(Strings.ErrorOrganizationNotUnique(identity12.OrganizationName))); if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.WriteableSession, adorganizationalUnit)) { this.WriteableSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.WriteableSession, adorganizationalUnit.OrganizationId, true); } if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.CurrentOrgConfigSession, adorganizationalUnit)) { this.CurrentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.CurrentOrgConfigSession, adorganizationalUnit.OrganizationId, true); this.RJProvider.IndexProvider.ConfigSession = this.CurrentOrgConfigSession; } } TIdentity identity13 = this.Identity; identity13.SetDefaultIndex(this.DefaultRequestIndexId); this.IndexEntry = this.GetEntry(); this.CheckIndexEntry(); if (this.IndexEntry == null) { return(null); } RequestJobObjectId requestJobId = this.IndexEntry.GetRequestJobId(); if (this.IndexEntry.TargetUserId != null) { requestJobId.TargetUser = this.ResolveADUser(this.IndexEntry.TargetUserId); } if (this.IndexEntry.SourceUserId != null) { requestJobId.SourceUser = this.ResolveADUser(this.IndexEntry.SourceUserId); } return((TransactionalRequestJob)this.RJProvider.Read <TransactionalRequestJob>(requestJobId)); }