Example #1
0
        private ExchangePrincipal GetExchangePrincipal(IConfigurable dataObject)
        {
            ADUser aduser = dataObject as ADUser;

            if (aduser != null)
            {
                if (!this.ShouldProcessArchive)
                {
                    if (aduser.RecipientType == RecipientType.MailUser)
                    {
                        base.WriteError(new InvalidOperationException(Strings.RecipientTypeNotValid(this.Identity.ToString())), ErrorCategory.InvalidOperation, null);
                    }
                    return(XsoStoreDataProviderBase.GetExchangePrincipalWithAdSessionSettingsForOrg(base.SessionSettings.CurrentOrganizationId, aduser));
                }
                if (aduser.ArchiveState != ArchiveState.None)
                {
                    return(ExchangePrincipal.FromMailboxGuid(base.SessionSettings, aduser.ArchiveGuid, RemotingOptions.AllowCrossSite | RemotingOptions.AllowCrossPremise, null));
                }
                base.WriteError(new InvalidOperationException(Strings.VerboseArchiveNotExistInStore(aduser.DisplayName)), ErrorCategory.InvalidOperation, null);
            }
            ADSystemMailbox adsystemMailbox = dataObject as ADSystemMailbox;

            if (adsystemMailbox != null)
            {
                return(ExchangePrincipal.FromADSystemMailbox(base.SessionSettings, adsystemMailbox, ((ITopologyConfigurationSession)this.ConfigurationSession).FindServerByLegacyDN(adsystemMailbox.ServerLegacyDN)));
            }
            return(null);
        }
Example #2
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(XsoStoreDataProviderBase.GetExchangePrincipalWithAdSessionSettingsForOrg(base.SessionSettings.CurrentOrganizationId, this.DataObject), (base.ExchangeRunspaceConfig == null) ? null : base.ExchangeRunspaceConfig.SecurityAccessToken, "Compare-TextMessagingVerificationCode"))
     {
         TextMessagingAccount textMessagingAccount = (TextMessagingAccount)versionedXmlDataProvider.Read<TextMessagingAccount>(this.DataObject.Identity);
         IList<PossibleRecipient> effectivePossibleRecipients = textMessagingAccount.TextMessagingSettings.MachineToPersonMessagingPolicies.EffectivePossibleRecipients;
         if (effectivePossibleRecipients.Count == 0)
         {
             base.WriteError(new NotificationPhoneNumberAbsentException(this.Identity.ToString()), ErrorCategory.InvalidData, this.Identity);
         }
         PossibleRecipient possibleRecipient = effectivePossibleRecipients[0];
         bool flag = false;
         if (string.IsNullOrEmpty(possibleRecipient.Passcode))
         {
             base.WriteError(new VerificationCodeNeverSentException(this.Identity.ToString()), ErrorCategory.InvalidData, this.Identity);
         }
         DateTime utcNow = DateTime.UtcNow;
         if (6 <= PossibleRecipient.CountTimesSince(possibleRecipient.PasscodeVerificationFailedTimeHistory, utcNow - TimeSpan.FromDays(1.0), true))
         {
             base.WriteError(new VerificationCodeTooManyFailedException(), ErrorCategory.InvalidData, this.Identity);
         }
         if (string.Equals(possibleRecipient.Passcode, this.VerificationCode, StringComparison.InvariantCultureIgnoreCase))
         {
             possibleRecipient.SetAcknowledged(true);
             ADUser dataObject = this.DataObject;
             SmsSqmDataPointHelper.AddNotificationTurningOnDataPoint(SmsSqmSession.Instance, dataObject.Id, dataObject.LegacyExchangeDN, textMessagingAccount);
         }
         else
         {
             possibleRecipient.PasscodeVerificationFailedTimeHistory.Add(utcNow);
             flag = true;
         }
         versionedXmlDataProvider.Save(textMessagingAccount);
         if (flag)
         {
             base.WriteError(new VerificationCodeUnmatchException(this.VerificationCode), ErrorCategory.InvalidData, this.Identity);
         }
         else if (!textMessagingAccount.EasEnabled)
         {
             TextMessagingHelper.SendSystemTextMessage(versionedXmlDataProvider.MailboxSession, textMessagingAccount.NotificationPhoneNumber, Strings.CalendarNotificationConfirmation.ToString(textMessagingAccount.NotificationPreferredCulture ?? TextMessagingHelper.GetSupportedUserCulture(this.DataObject)), true);
         }
     }
     TaskLogger.LogExit();
 }
Example #3
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     using (XsoMailboxDataProviderBase xsoMailboxDataProviderBase = (XsoMailboxDataProviderBase)this.CreateXsoMailboxDataProvider(XsoStoreDataProviderBase.GetExchangePrincipalWithAdSessionSettingsForOrg(base.SessionSettings.CurrentOrganizationId, this.DataObject), (base.ExchangeRunspaceConfig == null) ? null : base.ExchangeRunspaceConfig.SecurityAccessToken))
     {
         TDataObject tdataObject = (TDataObject)((object)xsoMailboxDataProviderBase.Read <TDataObject>(this.DataObject.Identity));
         if (tdataObject == null)
         {
             tdataObject = this.GetDefaultConfiguration();
         }
         this.StampChangesOnXsoObject(tdataObject);
         this.SaveXsoObject(xsoMailboxDataProviderBase, tdataObject);
     }
     TaskLogger.LogExit();
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(XsoStoreDataProviderBase.GetExchangePrincipalWithAdSessionSettingsForOrg(base.SessionSettings.CurrentOrganizationId, this.DataObject), (base.ExchangeRunspaceConfig == null) ? null : base.ExchangeRunspaceConfig.SecurityAccessToken, "Send-TextMessagingVerificationCode"))
     {
         TextMessagingAccount      textMessagingAccount        = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(this.DataObject.Identity);
         IList <PossibleRecipient> effectivePossibleRecipients = textMessagingAccount.TextMessagingSettings.MachineToPersonMessagingPolicies.EffectivePossibleRecipients;
         if (effectivePossibleRecipients.Count == 0)
         {
             base.WriteError(new NotificationPhoneNumberAbsentException(this.Identity.ToString()), ErrorCategory.InvalidData, this.Identity);
         }
         PossibleRecipient possibleRecipient = effectivePossibleRecipients[0];
         DateTime          utcNow            = DateTime.UtcNow;
         if (3 <= PossibleRecipient.CountTimesSince(possibleRecipient.PasscodeSentTimeHistory, utcNow - TimeSpan.FromMinutes(30.0), false))
         {
             this.WriteWarning(new VerificationCodeSentTooManyTimesException(textMessagingAccount.NotificationPhoneNumber.ToString()).LocalizedString);
             TaskLogger.LogExit();
             return;
         }
         if (PossibleRecipient.CountTimesSince(possibleRecipient.PasscodeSentTimeHistory, utcNow - TimeSpan.FromDays(1.0), true) == 0)
         {
             if (DateTime.UtcNow > SendTextMessagingVerificationCode.timeCreatingRandom + TimeSpan.FromSeconds((double)SendTextMessagingVerificationCode.timeSpan))
             {
                 SendTextMessagingVerificationCode.random             = new Random();
                 SendTextMessagingVerificationCode.timeCreatingRandom = DateTime.UtcNow;
                 SendTextMessagingVerificationCode.timeSpan           = new Random().Next(60);
             }
             possibleRecipient.SetPasscode(SendTextMessagingVerificationCode.random.Next(999999).ToString("000000"));
         }
         possibleRecipient.PasscodeSentTimeHistory.Add(utcNow);
         try
         {
             TextMessagingHelper.SendSystemTextMessage(versionedXmlDataProvider.MailboxSession, textMessagingAccount.NotificationPhoneNumber, Strings.PasscodeInformation(possibleRecipient.Passcode).ToString(textMessagingAccount.NotificationPreferredCulture ?? TextMessagingHelper.GetSupportedUserCulture(this.DataObject)), false);
         }
         catch (SendAsDeniedException innerException)
         {
             base.WriteError(new TextMessageInsufficientPermissionException(innerException), ErrorCategory.InvalidOperation, this.Identity);
         }
         versionedXmlDataProvider.Save(textMessagingAccount);
     }
     TaskLogger.LogExit();
 }
Example #5
0
        protected override void InternalProcessRecord()
        {
            XsoStoreDataProviderBase xsoStoreDataProviderBase = (XsoStoreDataProviderBase)base.DataSession;

            xsoStoreDataProviderBase.Delete(this.DataObject);
        }