コード例 #1
0
        protected override void ValidateRequest(TransactionalRequestJob requestJob)
        {
            DateTime?timestamp = requestJob.TimeTracker.GetTimestamp(RequestJobTimestamp.StartAfter);
            bool     flag      = RequestTaskHelper.CompareUtcTimeWithLocalTime(timestamp, this.StartAfter);
            bool     flag2     = base.IsFieldSet("StartAfter") && !flag;

            if (flag2)
            {
                this.CheckJobStatusInQueuedForStartAfterSet(requestJob);
            }
            DateTime utcNow = DateTime.UtcNow;

            if (flag2 && this.StartAfter != null)
            {
                RequestTaskHelper.ValidateStartAfterTime(this.StartAfter.Value.ToUniversalTime(), new Task.TaskErrorLoggingDelegate(base.WriteError), utcNow);
            }
            if (base.IsFieldSet("IncrementalSyncInterval"))
            {
                if (requestJob.IncrementalSyncInterval == TimeSpan.Zero || requestJob.JobType < MRSJobType.RequestJobE15_AutoResume)
                {
                    base.WriteError(new IncrementalSyncIntervalCannotBeSetOnNonIncrementalRequestsException(), ErrorCategory.InvalidArgument, this.Identity);
                }
                RequestTaskHelper.ValidateIncrementalSyncInterval(this.IncrementalSyncInterval, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            if (base.IsFieldSet("StartAfter") && flag)
            {
                this.WriteWarning(Strings.WarningScheduledTimeIsUnchanged("StartAfter"));
            }
            base.ValidateRequest(requestJob);
        }
コード例 #2
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            try
            {
                base.ValidateRootFolders(this.SourceRootFolder, this.TargetRootFolder);
                if (this.SourceMailbox != null)
                {
                    this.sourceUser = RequestTaskHelper.ResolveADUser(base.RecipSession, base.GCSession, base.ServerSettings, this.SourceMailbox, base.OptionalIdentityData, base.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true);
                    if (this.SourceIsArchive && (this.sourceUser.ArchiveGuid == Guid.Empty || this.sourceUser.ArchiveDatabase == null))
                    {
                        base.WriteError(new MailboxLacksArchivePermanentException(this.sourceUser.ToString()), ErrorCategory.InvalidArgument, this.SourceIsArchive);
                    }
                    if (!this.SourceIsArchive && this.sourceUser.Database == null)
                    {
                        base.WriteError(new MailboxLacksDatabasePermanentException(this.sourceUser.ToString()), ErrorCategory.InvalidArgument, this.SourceMailbox);
                    }
                }
                else
                {
                    this.sourceUser = null;
                }
                if (this.TargetMailbox != null)
                {
                    this.targetUser = RequestTaskHelper.ResolveADUser(base.RecipSession, base.GCSession, base.ServerSettings, this.TargetMailbox, base.OptionalIdentityData, base.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true);
                    if (this.TargetIsArchive && (this.targetUser.ArchiveGuid == Guid.Empty || this.targetUser.ArchiveDatabase == null))
                    {
                        base.WriteError(new MailboxLacksArchivePermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetIsArchive);
                    }
                    if (!this.TargetIsArchive && this.targetUser.Database == null)
                    {
                        base.WriteError(new MailboxLacksDatabasePermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox);
                    }
                }
                else
                {
                    this.targetUser = null;
                }
                this.DisallowMergeRequestForPublicFolderMailbox();
                bool wildcardedSearch = false;
                if (!string.IsNullOrEmpty(base.Name))
                {
                    base.ValidateName();
                    base.RequestName = base.Name;
                }
                else
                {
                    wildcardedSearch = true;
                    base.RequestName = "Merge";
                }
                AuthenticationMethod authenticationMethod = this.AuthenticationMethod;
                switch (authenticationMethod)
                {
                case AuthenticationMethod.Basic:
                case AuthenticationMethod.Ntlm:
                    goto IL_282;

                case AuthenticationMethod.Digest:
                    break;

                default:
                    if (authenticationMethod == AuthenticationMethod.LiveIdBasic)
                    {
                        goto IL_282;
                    }
                    break;
                }
                base.WriteError(new UnsupportedAuthMethodPermanentException(this.AuthenticationMethod.ToString()), ErrorCategory.InvalidArgument, this.AuthenticationMethod);
IL_282:
                if (base.ParameterSetName.Equals("MigrationLocalMerge"))
                {
                    if (!object.Equals(this.sourceUser.OrganizationId, this.targetUser.OrganizationId))
                    {
                        base.WriteError(new UsersNotInSameOrganizationPermanentException(this.sourceUser.ToString(), this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox);
                    }
                    base.RescopeToOrgId(this.sourceUser.OrganizationId);
                    base.ValidateLegacyDNMatch(this.sourceUser.LegacyExchangeDN, this.targetUser, this.TargetMailbox);
                    ADObjectId   mdbId         = null;
                    ADObjectId   mdbServerSite = null;
                    RequestFlags requestFlags  = this.LocateAndChooseMdb(this.SourceIsArchive ? this.sourceUser.ArchiveDatabase : this.sourceUser.Database, this.TargetIsArchive ? this.targetUser.ArchiveDatabase : this.targetUser.Database, this.SourceMailbox, this.TargetMailbox, this.TargetMailbox, out mdbId, out mdbServerSite);
                    base.MdbId         = mdbId;
                    base.MdbServerSite = mdbServerSite;
                    base.Flags         = (RequestFlags.IntraOrg | requestFlags);
                }
                else
                {
                    base.RescopeToOrgId(this.targetUser.OrganizationId);
                    ADObjectId mdbId2         = null;
                    ADObjectId mdbServerSite2 = null;
                    this.LocateAndChooseMdb(null, this.TargetIsArchive ? this.targetUser.ArchiveDatabase : this.targetUser.Database, null, this.TargetMailbox, this.TargetMailbox, out mdbId2, out mdbServerSite2);
                    base.MdbId         = mdbId2;
                    base.MdbServerSite = mdbServerSite2;
                    base.Flags         = (RequestFlags.CrossOrg | RequestFlags.Pull);
                }
                ADUser aduser;
                if ((base.Flags & RequestFlags.Pull) == RequestFlags.Pull)
                {
                    aduser = this.targetUser;
                }
                else
                {
                    aduser = this.sourceUser;
                }
                base.RequestName = this.CheckRequestNameAvailability(base.RequestName, aduser.Id, true, MRSRequestType.Merge, this.TargetMailbox, wildcardedSearch);
                if (base.IsFieldSet("IncrementalSyncInterval") && base.IsFieldSet("SuspendWhenReadyToComplete") && this.SuspendWhenReadyToComplete)
                {
                    base.WriteError(new SuspendWhenReadyToCompleteCannotBeSetWithIncrementalSyncIntervalException(), ErrorCategory.InvalidArgument, this.SuspendWhenReadyToComplete);
                }
                DateTime utcNow = DateTime.UtcNow;
                if (base.IsFieldSet("StartAfter"))
                {
                    RequestTaskHelper.ValidateStartAfterTime(this.StartAfter.ToUniversalTime(), new Task.TaskErrorLoggingDelegate(base.WriteError), utcNow);
                }
                if (base.IsFieldSet("IncrementalSyncInterval"))
                {
                    RequestTaskHelper.ValidateIncrementalSyncInterval(this.IncrementalSyncInterval, new Task.TaskErrorLoggingDelegate(base.WriteError));
                }
                base.InternalValidate();
            }
            finally
            {
                TaskLogger.LogExit();
            }
        }
コード例 #3
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     try
     {
         if (this.Mailbox == null)
         {
             ADObjectId adObjectId;
             if (!base.TryGetExecutingUserId(out adObjectId))
             {
                 throw new ExecutingUserPropertyNotFoundException("executingUserid");
             }
             this.Mailbox = new MailboxIdParameter(adObjectId);
         }
         this.targetUser            = RequestTaskHelper.ResolveADUser(base.RecipSession, base.GCSession, base.ServerSettings, this.Mailbox, base.OptionalIdentityData, base.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true);
         base.RecipSession          = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(base.RecipSession, this.targetUser.OrganizationId, true);
         base.CurrentOrganizationId = this.targetUser.OrganizationId;
         base.RJProvider.IndexProvider.RecipientSession = base.RecipSession;
         if (this.targetUser.Database == null)
         {
             base.WriteError(new MailboxLacksDatabasePermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.Mailbox);
         }
         if (this.AggregatedMailboxGuid != Guid.Empty)
         {
             MultiValuedProperty <Guid> multiValuedProperty = this.targetUser.AggregatedMailboxGuids ?? new MultiValuedProperty <Guid>();
             if (!multiValuedProperty.Contains(this.AggregatedMailboxGuid))
             {
                 base.WriteError(new AggregatedMailboxNotFoundPermanentException(this.AggregatedMailboxGuid, this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.AggregatedMailboxGuid);
             }
         }
         this.DataObject.DomainControllerToUpdate = this.targetUser.OriginatingServer;
         bool wildcardedSearch = false;
         if (!string.IsNullOrEmpty(this.Name))
         {
             base.ValidateName();
             base.RequestName = this.Name;
         }
         else if (this.Olc)
         {
             base.RequestName = "OlcSync";
         }
         else
         {
             wildcardedSearch = true;
             base.RequestName = "Sync";
         }
         base.RescopeToOrgId(this.targetUser.OrganizationId);
         ADObjectId   mdbId         = null;
         ADObjectId   mdbServerSite = null;
         RequestFlags requestFlags  = this.LocateAndChooseMdb(null, this.targetUser.Database, null, this.Mailbox, this.Mailbox, out mdbId, out mdbServerSite);
         base.MdbId         = mdbId;
         base.MdbServerSite = mdbServerSite;
         base.Flags         = (RequestFlags.CrossOrg | requestFlags);
         base.RequestName   = this.CheckRequestNameAvailability(base.RequestName, this.targetUser.Id, true, MRSRequestType.Sync, this.Mailbox, wildcardedSearch);
         if (this.Imap == true)
         {
             this.syncProtocol = SyncProtocol.Imap;
         }
         else if (this.Eas == true)
         {
             this.syncProtocol = SyncProtocol.Eas;
         }
         else if (this.Pop == true)
         {
             this.syncProtocol = SyncProtocol.Pop;
         }
         else if (this.Olc == true)
         {
             this.syncProtocol = SyncProtocol.Olc;
         }
         else
         {
             base.WriteError(new SyncProtocolNotSpecifiedPermanentException(), ErrorCategory.InvalidArgument, this.syncProtocol);
         }
         if (base.IsFieldSet("IncrementalSyncInterval"))
         {
             RequestTaskHelper.ValidateIncrementalSyncInterval(this.IncrementalSyncInterval, new Task.TaskErrorLoggingDelegate(base.WriteError));
         }
         DateTime utcNow = DateTime.UtcNow;
         if (base.IsFieldSet("StartAfter"))
         {
             RequestTaskHelper.ValidateStartAfterTime(this.StartAfter.ToUniversalTime(), new Task.TaskErrorLoggingDelegate(base.WriteError), utcNow);
         }
         if (base.IsFieldSet("StartAfter") && base.IsFieldSet("CompleteAfter"))
         {
             RequestTaskHelper.ValidateStartAfterComesBeforeCompleteAfter(new DateTime?(this.StartAfter.ToUniversalTime()), new DateTime?(this.CompleteAfter.ToUniversalTime()), new Task.TaskErrorLoggingDelegate(base.WriteError));
         }
         base.InternalValidate();
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
コード例 #4
0
        protected override void ValidateMoveRequest(TransactionalRequestJob moveRequest)
        {
            base.ValidateMoveRequestIsActive(moveRequest);
            base.ValidateMoveRequestProtectionStatus(moveRequest);
            base.ValidateMoveRequestIsSettable(moveRequest);
            if (base.IsFieldSet("SuspendWhenReadyToComplete"))
            {
                if (moveRequest.IsOffline)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorNoOfflineSuspendWhenReadyToComplete(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
                if (RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Completion))
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCannotAutoSuspendMoveAlreadyCompleting(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
            }
            if (base.IsFieldSet("RemoteCredential") && moveRequest.RequestStyle == RequestStyle.IntraOrg)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorNoRemoteCredentialSettingForLocalMove(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("RemoteGlobalCatalog") && moveRequest.RequestStyle == RequestStyle.IntraOrg)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorNoRemoteGlobalCatalogSettingForLocalMove(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("RemoteHostName") && moveRequest.RequestStyle == RequestStyle.IntraOrg)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorNoRemoteHostNameSettingForLocalMove(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("BadItemLimit") && this.BadItemLimit < new Unlimited <int>(moveRequest.BadItemsEncountered))
            {
                base.WriteError(new BadItemLimitAlreadyExceededPermanentException(moveRequest.Name, moveRequest.BadItemsEncountered, this.BadItemLimit.ToString()), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("LargeItemLimit") && moveRequest.AllowLargeItems)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorIncompatibleParameters("AllowLargeItems", "LargeItemLimit")), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("LargeItemLimit") && this.LargeItemLimit < new Unlimited <int>(moveRequest.LargeItemsEncountered))
            {
                base.WriteError(new LargeItemLimitAlreadyExceededPermanentException(moveRequest.Name, moveRequest.LargeItemsEncountered, this.LargeItemLimit.ToString()), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (this.PreventCompletion)
            {
                if (moveRequest.IsOffline)
                {
                    base.WriteError(new CannotPreventCompletionForOfflineMovePermanentException(), ErrorCategory.InvalidArgument, this.PreventCompletion);
                }
                if (RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Completion))
                {
                    base.WriteError(new CannotPreventCompletionForCompletingMovePermanentException(), ErrorCategory.InvalidArgument, this.PreventCompletion);
                }
                if (moveRequest.JobType >= MRSJobType.RequestJobE15_AutoResume)
                {
                    base.WriteError(new SuspendWRTCPreventCompletionCannotBeSetOnNewRequestsException(), ErrorCategory.InvalidArgument, this.PreventCompletion);
                }
            }
            DateTime?timestamp  = moveRequest.TimeTracker.GetTimestamp(RequestJobTimestamp.StartAfter);
            bool     flag       = RequestTaskHelper.CompareUtcTimeWithLocalTime(timestamp, this.StartAfter);
            DateTime?timestamp2 = moveRequest.TimeTracker.GetTimestamp(RequestJobTimestamp.CompleteAfter);
            bool     flag2      = RequestTaskHelper.CompareUtcTimeWithLocalTime(timestamp2, this.CompleteAfter);
            bool     flag3      = base.IsFieldSet("StartAfter") && !flag;
            bool     flag4      = base.IsFieldSet("CompleteAfter") && !flag2;

            if (flag3 || flag4 || base.IsFieldSet("IncrementalSyncInterval"))
            {
                this.CheckMoveStatusWithStartAfterAndCompleteAfterIncrementalSyncInterval(moveRequest);
            }
            if (flag3)
            {
                this.CheckMoveStatusInQueuedForStartAfterSet(moveRequest);
            }
            bool flag5 = base.IsFieldSet("SuspendWhenReadyToComplete") ? this.SuspendWhenReadyToComplete : moveRequest.SuspendWhenReadyToComplete;

            if (flag5 && moveRequest.JobType >= MRSJobType.RequestJobE15_AutoResume)
            {
                base.WriteError(new SuspendWRTCPreventCompletionCannotBeSetOnNewRequestsException(), ErrorCategory.InvalidArgument, this.SuspendWhenReadyToComplete);
            }
            DateTime utcNow = DateTime.UtcNow;

            if (flag3 && this.StartAfter != null)
            {
                RequestTaskHelper.ValidateStartAfterTime(this.StartAfter.Value.ToUniversalTime(), new Task.TaskErrorLoggingDelegate(base.WriteError), utcNow);
            }
            if (base.IsFieldSet("IncrementalSyncInterval"))
            {
                RequestTaskHelper.ValidateIncrementalSyncInterval(this.IncrementalSyncInterval, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            if (base.IsFieldSet("StartAfter") && flag)
            {
                this.WriteWarning(Strings.WarningScheduledTimeIsUnchanged("StartAfter"));
            }
            if (base.IsFieldSet("CompleteAfter") && flag2)
            {
                this.WriteWarning(Strings.WarningScheduledTimeIsUnchanged("CompleteAfter"));
            }
            if (base.IsFieldSet("TargetDatabase") || base.IsFieldSet("ArchiveTargetDatabase"))
            {
                if (!moveRequest.TargetIsLocal)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCannotRetargetOutboundMoves(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
                if (!RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Queued))
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCanRetargetOnlyQueuedMoves(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
                if (base.IsFieldSet("TargetDatabase") && moveRequest.ArchiveOnly)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCannotRetargetPrimaryForArchiveOnlyMoves(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
                if (base.IsFieldSet("ArchiveTargetDatabase") && moveRequest.PrimaryOnly)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCannotRetargetArchiveForPrimaryOnlyMoves(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
            }
        }