Пример #1
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);
            }
        }
Пример #2
0
        // Token: 0x060007D4 RID: 2004 RVA: 0x00019E0C File Offset: 0x0001800C
        public static bool IsPublicLogon(OrganizationId organizationId, HttpContext httpContext)
        {
            bool result;

            try
            {
                OwaOrgConfigData orgConfigTypeFromAd = UserContextUtilities.GetOrgConfigTypeFromAd(organizationId);
                result = (UserContextUtilities.IsPublicRequest(httpContext.Request) || (orgConfigTypeFromAd.PublicComputersDetectionEnabled && UserContextUtilities.IsPublicComputerSession(httpContext)));
            }
            catch (Exception ex)
            {
                ExTraceGlobals.CoreTracer.TraceError <string, string>(0L, "Failed to Get IsPublicLogon. Error: {0}. Stack: {1}.", ex.Message, ex.StackTrace);
                throw;
            }
            return(result);
        }