// Token: 0x06000806 RID: 2054 RVA: 0x0001A83C File Offset: 0x00018A3C
        private static WacConfigData GetWacConfigData(UserContext userContext)
        {
            WacConfigData wacConfigData = new WacConfigData();

            if (userContext == null)
            {
                throw new NullReferenceException("Retail assert: UserContext is null.");
            }
            if (userContext.FeaturesManager == null)
            {
                throw new NullReferenceException("Retail assert: UserContext.FeaturesManager is null.");
            }
            if (WacConfiguration.Instance == null)
            {
                throw new NullReferenceException("Retail assert: WacConfiguration.Instance is null.");
            }
            if (WacDiscoveryManager.Instance == null)
            {
                throw new NullReferenceException("Retail assert: WacDiscoveryManager.Instance is null.");
            }
            if (WacDiscoveryManager.Instance.WacDiscoveryResult == null)
            {
                throw new NullReferenceException("Retail assert: WacDiscoveryManager.Instance.WacDiscoveryResult is null.");
            }
            if (!WacConfiguration.Instance.BlockWacViewingThroughUI)
            {
                if (userContext.FeaturesManager.ClientServerSettings.DocCollab.Enabled || userContext.FeaturesManager.ClientServerSettings.ModernAttachments.Enabled)
                {
                    wacConfigData.IsWacEditingEnabled = WacConfiguration.Instance.EditingEnabled;
                }
                else
                {
                    wacConfigData.IsWacEditingEnabled = false;
                }
                try
                {
                    wacConfigData.WacViewableFileTypes  = WacDiscoveryManager.Instance.WacDiscoveryResult.WacViewableFileTypes;
                    wacConfigData.WacEditableFileTypes  = WacDiscoveryManager.Instance.WacDiscoveryResult.WacEditableFileTypes;
                    wacConfigData.WacDiscoverySucceeded = true;
                }
                catch (WacDiscoveryFailureException ex)
                {
                    OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, "DocCollab", ex.Message, ResultSeverityLevel.Error);
                    wacConfigData.WacViewableFileTypes  = new string[0];
                    wacConfigData.WacEditableFileTypes  = new string[0];
                    wacConfigData.WacDiscoverySucceeded = false;
                    wacConfigData.IsWacEditingEnabled   = false;
                }
            }
            if (userContext.IsBposUser)
            {
                string text;
                string text2;
                wacConfigData.OneDriveDiscoverySucceeded   = OneDriveProAttachmentDataProvider.TryGetBposDocumentsInfoFromBox(userContext, CallContext.Current, out text, out text2);
                wacConfigData.OneDriveDocumentsUrl         = (text ?? string.Empty);
                wacConfigData.OneDriveDocumentsDisplayName = (text2 ?? string.Empty);
            }
            else
            {
                wacConfigData.OneDriveDiscoverySucceeded   = true;
                wacConfigData.OneDriveDocumentsUrl         = string.Empty;
                wacConfigData.OneDriveDocumentsDisplayName = string.Empty;
            }
            return(wacConfigData);
        }
 // Token: 0x06000804 RID: 2052 RVA: 0x0001A7DB File Offset: 0x000189DB
 internal static bool IsAttachmentDataProviderAvailable(WacConfigData wacData)
 {
     return(!string.IsNullOrEmpty(wacData.OneDriveDocumentsUrl) || AttachmentDataProviderManager.IsMockDataProviderEnabled());
 }
예제 #3
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);
        }
        // Token: 0x06000803 RID: 2051 RVA: 0x0001A5D8 File Offset: 0x000187D8
        internal AttachmentPolicyType CreateAttachmentPolicyType(UserContext userContext, UserAgent userAgent, WacConfigData wacData)
        {
            AttachmentPolicyType attachmentPolicyType = new AttachmentPolicyType();

            attachmentPolicyType.DirectFileAccessOnPublicComputersEnabled  = this.directFileAccessOnPublicComputersEnabled;
            attachmentPolicyType.DirectFileAccessOnPrivateComputersEnabled = this.directFileAccessOnPrivateComputersEnabled;
            attachmentPolicyType.AllowedFileTypes   = this.allowedFileTypes;
            attachmentPolicyType.AllowedMimeTypes   = this.allowedMimeTypes;
            attachmentPolicyType.BlockedFileTypes   = this.blockedFileTypes;
            attachmentPolicyType.BlockedMimeTypes   = this.blockedMimeTypes;
            attachmentPolicyType.ForceSaveFileTypes = this.forceSaveFileTypes;
            attachmentPolicyType.ForceSaveMimeTypes = this.forceSaveMimeTypes;
            attachmentPolicyType.ActionForUnknownFileAndMIMETypes = this.treatUnknownTypeAs.ToString();
            if (userAgent != null && (string.Equals(userAgent.Platform, "iPhone", StringComparison.OrdinalIgnoreCase) || string.Equals(userAgent.Platform, "iPad", StringComparison.OrdinalIgnoreCase)))
            {
                string[] collection = new string[]
                {
                    ".dotm",
                    ".ppsm",
                    ".pptm",
                    ".xlsb",
                    ".xlsm",
                    ".wma"
                };
                List <string> list = new List <string>();
                list.AddRange(this.blockedFileTypes);
                list.AddRange(collection);
                attachmentPolicyType.BlockedFileTypes = list.ToArray();
            }
            attachmentPolicyType.AttachmentDataProviderAvailable = AttachmentPolicy.IsAttachmentDataProviderAvailable(wacData);
            userContext.SetWacEditingEnabled(wacData);
            attachmentPolicyType.WacViewableFileTypes = wacData.WacViewableFileTypes;
            attachmentPolicyType.WacEditableFileTypes = (userContext.IsWacEditingEnabled ? wacData.WacEditableFileTypes : new string[0]);
            attachmentPolicyType.WacViewingOnPublicComputersEnabled                  = this.wacViewingOnPublicComputersEnabled;
            attachmentPolicyType.WacViewingOnPrivateComputersEnabled                 = this.wacViewingOnPrivateComputersEnabled;
            attachmentPolicyType.ForceWacViewingFirstOnPublicComputers               = this.forceWacViewingFirstOnPublicComputers;
            attachmentPolicyType.ForceWacViewingFirstOnPrivateComputers              = this.forceWacViewingFirstOnPrivateComputers;
            attachmentPolicyType.ForceWebReadyDocumentViewingFirstOnPublicComputers  = this.forceWebReadyDocumentViewingFirstOnPublicComputers;
            attachmentPolicyType.ForceWebReadyDocumentViewingFirstOnPrivateComputers = this.forceWebReadyDocumentViewingFirstOnPrivateComputers;
            attachmentPolicyType.WebReadyDocumentViewingOnPublicComputersEnabled     = this.webReadyDocumentViewingOnPublicComputersEnabled;
            attachmentPolicyType.WebReadyDocumentViewingOnPrivateComputersEnabled    = this.webReadyDocumentViewingOnPrivateComputersEnabled;
            attachmentPolicyType.WebReadyFileTypes = this.webReadyFileTypes;
            attachmentPolicyType.WebReadyMimeTypes = this.webReadyMimeTypes;
            attachmentPolicyType.WebReadyDocumentViewingSupportedFileTypes   = this.webReadyDocumentViewingSupportedFileTypes;
            attachmentPolicyType.WebReadyDocumentViewingSupportedMimeTypes   = this.webReadyDocumentViewingSupportedMimeTypes;
            attachmentPolicyType.WebReadyDocumentViewingForAllSupportedTypes = this.webReadyDocumentViewingForAllSupportedTypes;
            attachmentPolicyType.DirectFileAccessOnPrivateComputersEnabled   = this.directFileAccessOnPrivateComputersEnabled;
            attachmentPolicyType.DirectFileAccessOnPublicComputersEnabled    = this.directFileAccessOnPublicComputersEnabled;
            return(attachmentPolicyType);
        }
예제 #5
0
        internal void SetWacEditingEnabled(WacConfigData wacData)
        {
            bool flag = AttachmentPolicy.IsAttachmentDataProviderAvailable(wacData);

            this.isWacEditingEnabled = new bool?(wacData.IsWacEditingEnabled && flag);
        }