Esempio n. 1
0
        // Token: 0x06000ABF RID: 2751 RVA: 0x00046714 File Offset: 0x00044914
        private bool TryReadUserConfiguration(MailboxInfo mailbox, out ADUser user, out UMDialPlan dialPlan, out bool sendSms, out bool sendMsgWaitingIndicator)
        {
            user     = null;
            dialPlan = null;
            sendSms  = false;
            sendMsgWaitingIndicator = false;
            IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(mailbox.OrganizationId, null);

            user = (iadrecipientLookup.LookupByExchangeGuid(mailbox.Guid) as ADUser);
            if (user == null)
            {
                ExTraceGlobals.MWITracer.TraceError <Guid>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: Could not find ADUser for mailbox {0}", mailbox.Guid);
                return(false);
            }
            if (!user.UMEnabled || user.UMMailboxPolicy == null || user.UMRecipientDialPlanId == null)
            {
                ExTraceGlobals.MWITracer.TraceError((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: ({0}): Invalid user({1}) UMEnabled({2}) UMMbxPol({3}) DialPlan({4})", new object[]
                {
                    mailbox.Guid,
                    user.DistinguishedName,
                    user.UMEnabled,
                    user.UMMailboxPolicy,
                    user.UMRecipientDialPlanId
                });
                return(false);
            }
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(user.UMMailboxPolicy), 1108, "TryReadUserConfiguration", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\mwi\\MwiAssistant.cs");
            UMMailboxPolicy       ummailboxPolicy = tenantOrTopologyConfigurationSession.Read <UMMailboxPolicy>(user.UMMailboxPolicy);

            if (ummailboxPolicy == null)
            {
                ExTraceGlobals.MWITracer.TraceError <ADObjectId, string>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: Could not find UMMailboxPolicy: {0}, User {1}", user.UMMailboxPolicy, user.DistinguishedName);
                return(false);
            }
            sendSms = ummailboxPolicy.AllowSMSNotification;
            sendMsgWaitingIndicator = ummailboxPolicy.AllowMessageWaitingIndicator;
            ExTraceGlobals.MWITracer.TraceDebug <bool, bool, string>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: AllowSMSNotification={0}, AllowMessageWaitingIndicator={1}, User {2}", sendSms, sendMsgWaitingIndicator, user.DistinguishedName);
            bool flag = sendSms || sendMsgWaitingIndicator;

            if (flag)
            {
                dialPlan = tenantOrTopologyConfigurationSession.Read <UMDialPlan>(user.UMRecipientDialPlanId);
                if (dialPlan == null)
                {
                    ExTraceGlobals.MWITracer.TraceError <ADObjectId>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: Could not find UMDialPlan: {0}", user.UMRecipientDialPlanId);
                    return(false);
                }
                ExTraceGlobals.MWITracer.TraceDebug <string, ADObjectId, UMSubscriberType>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration User {0} DialPlan{1}.SubscriberType={2}.", user.DistinguishedName, dialPlan.Id, dialPlan.SubscriberType);
            }
            return(flag);
        }
 // Token: 0x060010DC RID: 4316 RVA: 0x0006299C File Offset: 0x00060B9C
 public void CheckScaleRequirements()
 {
     this.Logger.TraceDebug(this, "Entering CheckScaleRequirements", new object[0]);
     if (VariantConfiguration.InvariantNoFlightingSnapshot.MailboxAssistants.OrgMailboxCheckScaleRequirements.Enabled)
     {
         try
         {
             IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(this.OrgId, null, null, false);
             ADUser             aduser             = iadrecipientLookup.LookupByExchangeGuid(this.RunData.MailboxGuid) as ADUser;
             if (aduser != null && aduser.PersistedCapabilities.Contains((Capability)this.CapabilityRequiringScaling))
             {
                 if (OrgMailboxScaleOutHelper.IsFactoryDefaultMailbox(aduser.Name))
                 {
                     this.Logger.TraceDebug(this, "CheckOrgMailboxScaleRequirements - Checking tenant size, mailbox='{0}'", new object[]
                     {
                         aduser.Name
                     });
                     int mailboxCount  = 0;
                     int contactCount  = 0;
                     int mailUserCount = 0;
                     this.GetTenantRecipientCount(out mailboxCount, out contactCount, out mailUserCount);
                     int organizationMailboxCount = this.GetOrganizationMailboxCount();
                     this.Logger.TraceDebug(this, "CheckOrgMailboxScaleRequirements - Scale out threshold='{0}'", new object[]
                     {
                         OrgMailboxScaleOutHelper.scaleOutThreshold
                     });
                     bool shouldCapabilityExist = this.ShouldStampScaleOutCapability(mailboxCount, contactCount, mailUserCount, organizationMailboxCount, OrgMailboxScaleOutHelper.scaleOutThreshold);
                     this.UpdateOrganizationScaleOutCapability(aduser, shouldCapabilityExist);
                 }
                 this.UpdateOrganizationMailboxCapabilities(aduser);
             }
         }
         catch (LocalizedException obj)
         {
             UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_SetScaleOutCapabilityFailed, null, new object[]
             {
                 this.RunData.TenantId,
                 this.RunData.MailboxGuid,
                 this.RunData.RunId,
                 CommonUtil.ToEventLogString(obj)
             });
         }
     }
     this.Logger.TraceDebug(this, "Exiting CheckScaleRequirements", new object[0]);
 }
        // Token: 0x06000B05 RID: 2821 RVA: 0x000478FC File Offset: 0x00045AFC
        protected override void HandleEventInternal(MapiEvent mapiEvent, MailboxSession mailboxSession, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
        {
            if (mailboxSession == null)
            {
                throw new ArgumentNullException("mailboxSession");
            }
            if (item == null)
            {
                UMPartnerMessageAssistant.Tracer.TraceWarning <MapiEvent, StoreObject>((long)this.GetHashCode(), "UMPMA.HandleEvent: Ignoring evt={0}, item={1}", mapiEvent, item);
                return;
            }
            IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(mailboxSession.MailboxOwner.MailboxInfo.OrganizationId, null);
            ADUser             aduser             = iadrecipientLookup.LookupByExchangeGuid(mailboxSession.MailboxGuid) as ADUser;

            if (aduser == null)
            {
                UMPartnerMessageAssistant.Tracer.TraceWarning <Guid>((long)this.GetHashCode(), "UMPMA.HandleEvent: Could not find ADUser for mailbox {0} {1}", mailboxSession.MailboxGuid);
                throw new SkipException(new UserNotUmEnabledException(mailboxSession.MailboxGuid.ToString()));
            }
            if (!aduser.UMEnabled || aduser.UMMailboxPolicy == null || aduser.UMRecipientDialPlanId == null)
            {
                UMPartnerMessageAssistant.Tracer.TraceWarning(0L, "UMPMA.HandleEvent({0} - {1}) - Invalid user: UMEnabled({2}) UMMbxPol({3}) DialPlan({4})", new object[]
                {
                    mailboxSession.MailboxGuid,
                    aduser.DistinguishedName,
                    aduser.UMEnabled,
                    aduser.UMMailboxPolicy,
                    aduser.UMRecipientDialPlanId
                });
                throw new SkipException(new UserNotUmEnabledException(aduser.DistinguishedName));
            }
            try
            {
                this.ProcessEvent(aduser, mailboxSession, item);
            }
            catch (Exception arg)
            {
                UMPartnerMessageAssistant.Tracer.TraceWarning <Guid, string, Exception>(0L, "UMPMA.HandleEvent({0} - {1}) - Exception:{2}", mailboxSession.MailboxGuid, aduser.DistinguishedName, arg);
                throw;
            }
        }