示例#1
0
 private void CreateFeatureManagerFactoryFromMailbox(OWAMiniRecipient miniRecipient)
 {
     UserConfigurationManager.IAggregationContext aggregationContext = null;
     try
     {
         this.LockAndReconnectMailboxSession();
         aggregationContext = base.MailboxSession.UserConfigurationManager.AttachAggregator(AggregatedUserConfigurationSchema.Instance.OwaUserConfiguration);
         base.UnlockAndDisconnectMailboxSession();
         OwaFlightConfigData  owaFlightConfigData  = UserContext.ReadAggregatedFlightConfigData(aggregationContext, base.ExchangePrincipal.MailboxInfo.OrganizationId);
         RecipientTypeDetails recipientTypeDetails = base.ExchangePrincipal.RecipientTypeDetails;
         this.featuresManagerFactory = new FeaturesManagerFactory(miniRecipient, new ConfigurationContext(this), new ScopeFlightsSettingsProvider(), (VariantConfigurationSnapshot c) => new FeaturesStateOverride(c, recipientTypeDetails), owaFlightConfigData.RampId, owaFlightConfigData.IsFirstRelease);
     }
     finally
     {
         if (aggregationContext != null)
         {
             aggregationContext.Detach();
             this.bootAggregationContext = aggregationContext;
         }
         if (base.MailboxSessionLockedByCurrentThread())
         {
             base.UnlockAndDisconnectMailboxSession();
         }
     }
 }
示例#2
0
        protected override OwaUserConfiguration InternalExecute()
        {
            MailboxSession mailboxIdentityMailboxSession = base.MailboxIdentityMailboxSession;
            UserContext    userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true);

            UserConfigurationManager.IAggregationContext aggregationContext = null;
            OwaUserConfiguration result;

            try
            {
                if (!DefaultPageBase.IsRecoveryBoot(base.CallContext.HttpContext))
                {
                    using (UserConfigurationManager.IAggregationContext aggregationContext2 = userContext.TryConsumeBootAggregation())
                    {
                        if (aggregationContext2 != null)
                        {
                            aggregationContext = mailboxIdentityMailboxSession.UserConfigurationManager.AttachAggregator(aggregationContext2);
                        }
                        else
                        {
                            aggregationContext = this.CreateAggregatedConfiguration(userContext, mailboxIdentityMailboxSession);
                        }
                    }
                }
                UserOptionsType userOptionsType = new UserOptionsType();
                userOptionsType.Load(mailboxIdentityMailboxSession, true, true);
                OwaUserConfiguration owaUserConfiguration = new OwaUserConfiguration();
                owaUserConfiguration.UserOptions = userOptionsType;
                string    userAgent  = CallContext.Current.HttpContext.Request.UserAgent;
                UserAgent userAgent2 = new UserAgent(userAgent, userContext.FeaturesManager.ClientServerSettings.ChangeLayout.Enabled, base.CallContext.HttpContext.Request.Cookies);
                StorePerformanceCountersCapture countersCapture = StorePerformanceCountersCapture.Start(mailboxIdentityMailboxSession);
                UMSettingsData umSettings = this.ReadAggregatedUMSettingsData(aggregationContext, userContext.ExchangePrincipal);
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.UMClient, countersCapture, true);
                owaUserConfiguration.SessionSettings = new SessionSettingsType(userContext, mailboxIdentityMailboxSession, userAgent2, base.CallContext, umSettings, this.ReadAggregatedOwaHelpUrlData(aggregationContext, Thread.CurrentThread.CurrentUICulture, userContext.MailboxIdentity, userAgent2));
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SessionSettings, countersCapture, true);
                ConfigurationContext configurationContext = new ConfigurationContext(userContext, aggregationContext);
                string defaultTheme = configurationContext.DefaultTheme;
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.ConfigContext, countersCapture, true);
                owaUserConfiguration.SegmentationSettings = new SegmentationSettingsType(configurationContext);
                owaUserConfiguration.SegmentationSettings.InstantMessage &= !UserAgentUtilities.IsMonitoringRequest(userAgent);
                owaUserConfiguration.SegmentationSettings.InstantMessage &= VdirConfiguration.Instance.InstantMessagingEnabled;
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SegmentationSettings, countersCapture, true);
                WacConfigData wacData = AttachmentPolicy.ReadAggregatedWacData(userContext, aggregationContext);
                owaUserConfiguration.AttachmentPolicy = configurationContext.AttachmentPolicy.CreateAttachmentPolicyType(userContext, userAgent2, wacData);
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.AttachmentPolicy, countersCapture, true);
                PolicySettingsType policySettingsType = new PolicySettingsType();
                policySettingsType.PlacesEnabled  = (this.placesConfigurationCache.IsFeatureEnabled && configurationContext.PlacesEnabled && !PlacesConfigurationCache.IsRestrictedCulture(owaUserConfiguration.SessionSettings.UserCulture));
                policySettingsType.WeatherEnabled = (this.weatherConfigurationCache.IsFeatureEnabled && configurationContext.WeatherEnabled && !this.weatherConfigurationCache.IsRestrictedCulture(owaUserConfiguration.SessionSettings.UserCulture));
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.PlacesWeather, countersCapture, true);
                policySettingsType.DefaultTheme         = configurationContext.DefaultTheme;
                policySettingsType.InstantMessagingType = configurationContext.InstantMessagingType;
                policySettingsType.UseGB18030           = configurationContext.UseGB18030;
                policySettingsType.UseISO885915         = configurationContext.UseISO885915;
                policySettingsType.OutboundCharset      = configurationContext.OutboundCharset;
                policySettingsType.AllowCopyContactsToDeviceAddressBook = configurationContext.AllowCopyContactsToDeviceAddressBook;
                policySettingsType.AllowOfflineOnString = configurationContext.AllowOfflineOn.ToString();
                policySettingsType.MySiteUrl            = configurationContext.MySiteUrl;
                owaUserConfiguration.PolicySettings     = policySettingsType;
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.PolicySettings, countersCapture, true);
                owaUserConfiguration.MobileDevicePolicySettings = MobileDevicePolicyDataFactory.GetPolicySettings(this.ReadAggregatedMobileDevicePolicyData(aggregationContext, userContext.ExchangePrincipal));
                owaUserConfiguration.ApplicationSettings        = this.GetApplicationSettings();
                owaUserConfiguration.ViewStateConfiguration     = new OwaViewStateConfiguration();
                owaUserConfiguration.ViewStateConfiguration.LoadAll(mailboxIdentityMailboxSession);
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.OwaViewStateConfiguration, countersCapture, true);
                OrganizationId organizationId = mailboxIdentityMailboxSession.MailboxOwner.MailboxInfo.OrganizationId;
                this.SetUserConfigPropertiesFromOrganizationConfig(aggregationContext, organizationId, owaUserConfiguration);
                userContext.IsPublicLogon = (owaUserConfiguration.SessionSettings.IsPublicLogon || (owaUserConfiguration.PublicComputersDetectionEnabled && owaUserConfiguration.SessionSettings.IsPublicComputerSession));
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetMailTipsLargeAudienceThreshold, countersCapture, true);
                owaUserConfiguration.RetentionPolicyTags = this.GetRetentionPolicyTags(mailboxIdentityMailboxSession);
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetRetentionPolicyTags, countersCapture, true);
                try
                {
                    owaUserConfiguration.MasterCategoryList = MasterCategoryListHelper.GetMasterCategoryListType(mailboxIdentityMailboxSession, base.CallContext.OwaCulture);
                }
                catch (QuotaExceededException ex)
                {
                    ExTraceGlobals.UserContextCallTracer.TraceDebug <string>(0L, "GetOwaUserConfiguration:  Get MasterCategoryList failed. Exception: {0}", ex.Message);
                }
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetMasterCategoryListType, countersCapture, true);
                owaUserConfiguration.MaxRecipientsPerMessage = this.GetMaxRecipientsPerMessage();
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetMaxRecipientsPerMessage, countersCapture, false);
                owaUserConfiguration.RecoverDeletedItemsEnabled = configurationContext.RecoverDeletedItemsEnabled;
                base.CallContext.ProtocolLog.Set(OwaUserConfigurationLogMetadata.UserCulture, owaUserConfiguration.SessionSettings.UserCulture);
                Converter <KeyValuePair <string, string>, string> converter;
                if (userContext.FeaturesManager.ServerSettings.FlightFormat.Enabled)
                {
                    converter = ((KeyValuePair <string, string> pair) => "&" + pair.Key + ":" + pair.Value);
                }
                else
                {
                    converter = ((KeyValuePair <string, string> pair) => pair.Key + " = " + pair.Value);
                }
                if (userContext.FeaturesManager.ConfigurationSnapshot != null && userContext.FeaturesManager.ClientSettings.OWADiagnostics.Enabled)
                {
                    owaUserConfiguration.FlightConfiguration = Array.ConvertAll <KeyValuePair <string, string>, string>(userContext.FeaturesManager.ConfigurationSnapshot.Constraints, converter);
                }
                else
                {
                    owaUserConfiguration.FlightConfiguration = new string[0];
                }
                this.ReadInferenceSettings(mailboxIdentityMailboxSession, userContext, owaUserConfiguration);
                if (base.CallContext.IsSmimeInstalled)
                {
                    owaUserConfiguration.SmimeAdminSettings = new SmimeAdminSettingsType(this.ReadAggregatedSmimeData(aggregationContext, organizationId));
                }
                VariantConfigurationSnapshot configurationSnapshot = userContext.FeaturesManager.ConfigurationSnapshot;
                if (configurationSnapshot != null)
                {
                    IInlineExploreSettings inlineExploreSettings = configurationSnapshot.OwaServer.InlineExploreSettings;
                    if (inlineExploreSettings != null)
                    {
                        owaUserConfiguration.InlineExploreContent = inlineExploreSettings.Content;
                    }
                }
                owaUserConfiguration.PolicyTipsEnabled = this.ReadAggregatedPolicyTipsData(aggregationContext, organizationId).IsPolicyTipsEnabled;
                UserContext.ReadAggregatedFlightConfigData(aggregationContext, organizationId);
                this.RecordAggregationStats(aggregationContext);
                result = owaUserConfiguration;
            }
            finally
            {
                this.ValidateAndDisposeAggregatedConfiguration(aggregationContext, mailboxIdentityMailboxSession);
            }
            return(result);
        }