Ejemplo n.º 1
0
        protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
        {
            IConfigurable configurable = base.ConvertDataObjectToPresentationObject(dataObject);
            Mailbox       mailbox      = configurable as Mailbox;

            if (mailbox == null)
            {
                return(null);
            }
            TenantPublicFolderConfiguration value = TenantPublicFolderConfigurationCache.Instance.GetValue(mailbox.OrganizationId);
            bool flag = mailbox.RecipientTypeDetails == Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails.PublicFolderMailbox;

            if (!flag)
            {
                if (mailbox.DefaultPublicFolderMailboxValue == null || mailbox.DefaultPublicFolderMailboxValue.IsDeleted)
                {
                    PublicFolderRecipient publicFolderRecipient = value.GetPublicFolderRecipient(mailbox.ExchangeGuid, null);
                    if (publicFolderRecipient != null)
                    {
                        if (base.NeedSuppressingPiiData)
                        {
                            string text;
                            string text2;
                            mailbox.DefaultPublicFolderMailbox = SuppressingPiiData.Redact(publicFolderRecipient.ObjectId, out text, out text2);
                        }
                        else
                        {
                            mailbox.DefaultPublicFolderMailbox = publicFolderRecipient.ObjectId;
                        }
                    }
                }
                else
                {
                    mailbox.DefaultPublicFolderMailbox = mailbox.DefaultPublicFolderMailboxValue;
                }
            }
            mailbox.IsRootPublicFolderMailbox = (flag && value.GetHierarchyMailboxInformation().HierarchyMailboxGuid == mailbox.ExchangeGuid);
            if (this.UsnForReconciliationSearch >= 0L)
            {
                mailbox.ReconciliationId = mailbox.NetID;
            }
            mailbox.ResetChangeTracking();
            return(mailbox);
        }
Ejemplo n.º 2
0
        // Token: 0x0600211A RID: 8474 RVA: 0x0007953C File Offset: 0x0007773C
        internal SessionSettingsType(UserContext userContext, MailboxSession mailboxSession, UserAgent userAgent, CallContext callContext, UMSettingsData umSettings, OwaHelpUrlData helpUrlData)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (userContext.ExchangePrincipal == null)
            {
                throw new OwaInvalidRequestException("userContext.ExchangePrincipal is null");
            }
            StorePerformanceCountersCapture countersCapture = StorePerformanceCountersCapture.Start(mailboxSession);

            this.userDisplayName      = userContext.ExchangePrincipal.MailboxInfo.DisplayName;
            this.userEmailAddress     = userContext.ExchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString();
            this.userLegacyExchangeDN = userContext.ExchangePrincipal.LegacyDn;
            this.hasArchive           = this.UserHasArchive(userContext.ExchangePrincipal);
            this.archiveDisplayName   = (this.hasArchive ? userContext.ExchangePrincipal.GetArchiveMailbox().ArchiveName : string.Empty);
            IEnumerable <string> source = from emailAddress in userContext.ExchangePrincipal.MailboxInfo.EmailAddresses
                                          select emailAddress.AddressString;

            if (source.Any <string>())
            {
                this.userProxyAddresses = source.ToArray <string>();
            }
            this.UpdateMailboxQuotaLimits(mailboxSession);
            this.isBposUser        = userContext.IsBposUser;
            this.userSipUri        = userContext.SipUri;
            this.userPrincipalName = userContext.UserPrincipalName;
            this.isGallatin        = SessionSettingsType.GetIsGallatin();
            if (userContext.ExchangePrincipal.MailboxInfo.OrganizationId != null)
            {
                this.TenantGuid = userContext.ExchangePrincipal.MailboxInfo.OrganizationId.GetTenantGuid().ToString();
            }
            if (userContext.LogEventCommonData != null)
            {
                this.TenantDomain = userContext.LogEventCommonData.TenantDomain;
            }
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SessionSettingsMisc, countersCapture, true);
            int?maximumMessageSize = SessionSettingsType.GetMaximumMessageSize(mailboxSession);

            this.maxMessageSizeInKb = ((maximumMessageSize != null) ? maximumMessageSize.Value : 5120);
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SessionSettingsMessageSize, countersCapture, true);
            this.isPublicLogon = UserContextUtilities.IsPublicRequest(callContext.HttpContext.Request);
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SessionSettingsIsPublicLogon, countersCapture, true);
            ADUser aduser = null;

            if (userContext.IsExplicitLogon)
            {
                IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.IgnoreInvalid, null, userContext.ExchangePrincipal.MailboxInfo.OrganizationId.ToADSessionSettings(), 303, ".ctor", "f:\\15.00.1497\\sources\\dev\\clients\\src\\Owa2\\Server\\Core\\types\\SessionSettingsType.cs");
                aduser = (DirectoryHelper.ReadADRecipient(userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, userContext.ExchangePrincipal.MailboxInfo.IsArchive, tenantOrRootOrgRecipientSession) as ADUser);
                if (aduser != null && aduser.SharePointUrl != null)
                {
                    this.sharePointUrl   = aduser.SharePointUrl.ToString();
                    this.sharePointTitle = aduser.DisplayName;
                }
            }
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.TeamMailbox, countersCapture, true);
            if (userContext.LogonIdentity != null)
            {
                OWAMiniRecipient owaminiRecipient = userContext.LogonIdentity.GetOWAMiniRecipient();
                this.LogonEmailAddress = string.Empty;
                if (owaminiRecipient != null)
                {
                    SmtpAddress primarySmtpAddress = owaminiRecipient.PrimarySmtpAddress;
                    this.LogonEmailAddress = owaminiRecipient.PrimarySmtpAddress.ToString();
                }
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetOWAMiniRecipient, countersCapture, false);
            }
            this.MailboxGuid     = userContext.ExchangePrincipal.MailboxInfo.MailboxGuid.ToString();
            this.isExplicitLogon = userContext.IsExplicitLogon;
            this.isExplicitLogonOthersMailbox = false;
            this.canActAsOwner = true;
            countersCapture    = StorePerformanceCountersCapture.Start(mailboxSession);
            this.SetDefaultFolderMapping(mailboxSession);
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SetDefaultFolderMapping, countersCapture, false);
            CultureInfo currentUICulture = Thread.CurrentThread.CurrentUICulture;

            this.userCulture = currentUICulture.Name;
            this.isUserCultureSpeechEnabled = Culture.IsCultureSpeechEnabled(currentUICulture);
            this.isUserCultureRightToLeft   = currentUICulture.TextInfo.IsRightToLeft;
            countersCapture                    = StorePerformanceCountersCapture.Start(mailboxSession);
            this.playOnPhoneDialString         = umSettings.PlayOnPhoneDialString;
            this.isRequireProtectedPlayOnPhone = umSettings.IsRequireProtectedPlayOnPhone;
            this.isUMEnabled                   = umSettings.IsUMEnabled;
            if (SyncUtilities.IsDatacenterMode())
            {
                SendAsSubscriptionsAndPeopleConnectResult allSendAsSubscriptionsAndPeopleConnect = SubscriptionManager.GetAllSendAsSubscriptionsAndPeopleConnect(mailboxSession);
                List <PimAggregationSubscription>         pimSendAsAggregationSubscriptionList   = allSendAsSubscriptionsAndPeopleConnect.PimSendAsAggregationSubscriptionList;
                this.PeopleConnectionsExist = allSendAsSubscriptionsAndPeopleConnect.PeopleConnectionsExist;
                List <AggregatedAccountInfo> list = null;
                if (aduser == null && userContext.ExchangePrincipal != null)
                {
                    IRecipientSession tenantOrRootOrgRecipientSession2 = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.IgnoreInvalid, null, userContext.ExchangePrincipal.MailboxInfo.OrganizationId.ToADSessionSettings(), 375, ".ctor", "f:\\15.00.1497\\sources\\dev\\clients\\src\\Owa2\\Server\\Core\\types\\SessionSettingsType.cs");
                    aduser = (DirectoryHelper.ReadADRecipient(userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, userContext.ExchangePrincipal.MailboxInfo.IsArchive, tenantOrRootOrgRecipientSession2) as ADUser);
                }
                if (aduser != null)
                {
                    AggregatedAccountHelper aggregatedAccountHelper = new AggregatedAccountHelper(mailboxSession, aduser);
                    list = aggregatedAccountHelper.GetListOfAccounts();
                }
                int capacity = pimSendAsAggregationSubscriptionList.Count + ((list != null) ? list.Count : 0);
                List <ConnectedAccountInfo> list2 = new List <ConnectedAccountInfo>(capacity);
                foreach (PimAggregationSubscription pimAggregationSubscription in pimSendAsAggregationSubscriptionList)
                {
                    list2.Add(new ConnectedAccountInfo
                    {
                        SubscriptionGuid = pimAggregationSubscription.SubscriptionGuid,
                        EmailAddress     = SessionSettingsType.DecodeIdnDomain(pimAggregationSubscription.UserEmailAddress),
                        DisplayName      = pimAggregationSubscription.UserDisplayName
                    });
                }
                if (list != null)
                {
                    foreach (AggregatedAccountInfo aggregatedAccountInfo in list)
                    {
                        bool   flag = false;
                        string aggregatedAccountEmail = SessionSettingsType.DecodeIdnDomain(aggregatedAccountInfo.SmtpAddress);
                        if (!string.IsNullOrWhiteSpace(aggregatedAccountEmail))
                        {
                            if (list2.Find((ConnectedAccountInfo account) => StringComparer.InvariantCultureIgnoreCase.Equals(account.EmailAddress, aggregatedAccountEmail)) != null)
                            {
                                break;
                            }
                            if (!flag)
                            {
                                list2.Add(new ConnectedAccountInfo
                                {
                                    SubscriptionGuid = aggregatedAccountInfo.RequestGuid,
                                    EmailAddress     = aggregatedAccountEmail,
                                    DisplayName      = aggregatedAccountEmail
                                });
                            }
                        }
                    }
                }
                this.connectedAccountInfos = list2.ToArray();
            }
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.IsDatacenterMode, countersCapture, true);
            this.helpUrl = helpUrlData.HelpUrl;
            this.isPublicComputerSession = UserContextUtilities.IsPublicComputerSession(callContext.HttpContext);
            string errorString = string.Empty;

            try
            {
                IMailboxInfo mailboxInfo = userContext.ExchangePrincipal.MailboxInfo;
                TenantPublicFolderConfiguration tenantPublicFolderConfiguration = null;
                if (TenantPublicFolderConfigurationCache.Instance.TryGetValue(mailboxInfo.OrganizationId, out tenantPublicFolderConfiguration))
                {
                    ADObjectId            defaultPublicFolderMailbox = userContext.ExchangePrincipal.DefaultPublicFolderMailbox;
                    PublicFolderRecipient publicFolderRecipient      = tenantPublicFolderConfiguration.GetPublicFolderRecipient(mailboxInfo.MailboxGuid, defaultPublicFolderMailbox);
                    if (publicFolderRecipient != null)
                    {
                        if (publicFolderRecipient.IsLocal)
                        {
                            this.DefaultPublicFolderMailbox = publicFolderRecipient.PrimarySmtpAddress.ToString();
                        }
                        else if (publicFolderRecipient.ObjectId == null)
                        {
                            errorString = "publicFolderRecipient not local and ObjectId null";
                        }
                        else
                        {
                            errorString = "publicFolderRecipient not local and ObjectId " + publicFolderRecipient.ObjectId.ObjectGuid;
                        }
                    }
                    else
                    {
                        errorString = "publicFolderRecipient null";
                    }
                }
            }
            catch (LocalizedException ex)
            {
                errorString = ex.ToString();
            }
            finally
            {
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.DefaultPublicFolderMailbox, countersCapture, true, errorString);
            }
        }