internal static PolicyConfiguration CreatePolicyConfigurationFromOwaMailboxPolicy(OwaMailboxPolicy owaMailboxPolicy)
        {
            if (owaMailboxPolicy == null)
            {
                return(null);
            }
            PolicyConfiguration   policyConfiguration = new PolicyConfiguration();
            AttachmentPolicyLevel treatUnknownTypeAs  = ConfigurationBase.AttachmentActionToPolicyLevel(new AttachmentBlockingActions?(owaMailboxPolicy.ActionForUnknownFileAndMIMETypes));
            AttachmentPolicy      attachmentPolicy    = new AttachmentPolicy(owaMailboxPolicy.BlockedFileTypes.ToArray(), owaMailboxPolicy.BlockedMimeTypes.ToArray(), owaMailboxPolicy.ForceSaveFileTypes.ToArray(), owaMailboxPolicy.ForceSaveMimeTypes.ToArray(), owaMailboxPolicy.AllowedFileTypes.ToArray(), owaMailboxPolicy.AllowedMimeTypes.ToArray(), treatUnknownTypeAs, owaMailboxPolicy.DirectFileAccessOnPublicComputersEnabled, owaMailboxPolicy.DirectFileAccessOnPrivateComputersEnabled, owaMailboxPolicy.ForceWacViewingFirstOnPublicComputers, owaMailboxPolicy.ForceWacViewingFirstOnPrivateComputers, owaMailboxPolicy.WacViewingOnPublicComputersEnabled, owaMailboxPolicy.WacViewingOnPrivateComputersEnabled, owaMailboxPolicy.ForceWebReadyDocumentViewingFirstOnPublicComputers, owaMailboxPolicy.ForceWebReadyDocumentViewingFirstOnPrivateComputers, owaMailboxPolicy.WebReadyDocumentViewingOnPublicComputersEnabled, owaMailboxPolicy.WebReadyDocumentViewingOnPrivateComputersEnabled, owaMailboxPolicy.WebReadyFileTypes.ToArray(), owaMailboxPolicy.WebReadyMimeTypes.ToArray(), owaMailboxPolicy.WebReadyDocumentViewingSupportedFileTypes.ToArray(), owaMailboxPolicy.WebReadyDocumentViewingSupportedMimeTypes.ToArray(), owaMailboxPolicy.WebReadyDocumentViewingForAllSupportedTypes);

            policyConfiguration.AttachmentPolicy = attachmentPolicy;
            int segmentationBits  = (int)owaMailboxPolicy[OwaMailboxPolicySchema.ADMailboxFolderSet];
            int segmentationBits2 = (int)owaMailboxPolicy[OwaMailboxPolicySchema.ADMailboxFolderSet2];

            policyConfiguration.SegmentationFlags    = ConfigurationBase.SetSegmentationFlags(segmentationBits, segmentationBits2);
            policyConfiguration.OutboundCharset      = owaMailboxPolicy.OutboundCharset;
            policyConfiguration.UseGB18030           = owaMailboxPolicy.UseGB18030;
            policyConfiguration.UseISO885915         = owaMailboxPolicy.UseISO885915;
            policyConfiguration.InstantMessagingType = ((owaMailboxPolicy.InstantMessagingType != null) ? owaMailboxPolicy.InstantMessagingType.Value : InstantMessagingTypeOptions.None);
            policyConfiguration.DefaultTheme         = owaMailboxPolicy.DefaultTheme;
            policyConfiguration.PlacesEnabled        = owaMailboxPolicy.PlacesEnabled;
            policyConfiguration.WeatherEnabled       = owaMailboxPolicy.WeatherEnabled;
            policyConfiguration.AllowCopyContactsToDeviceAddressBook = owaMailboxPolicy.AllowCopyContactsToDeviceAddressBook;
            policyConfiguration.AllowOfflineOn             = owaMailboxPolicy.AllowOfflineOn;
            policyConfiguration.RecoverDeletedItemsEnabled = owaMailboxPolicy.RecoverDeletedItemsEnabled;
            policyConfiguration.GroupCreationEnabled       = owaMailboxPolicy.GroupCreationEnabled;
            return(policyConfiguration);
        }
 // Token: 0x060007FC RID: 2044 RVA: 0x0001A370 File Offset: 0x00018570
 internal AttachmentPolicy(string[] blockFileTypes, string[] blockMimeTypes, string[] forceSaveFileTypes, string[] forceSaveMimeTypes, string[] allowFileTypes, string[] allowMimeTypes, AttachmentPolicyLevel treatUnknownTypeAs, bool directFileAccessOnPublicComputersEnabled, bool directFileAccessOnPrivateComputersEnabled, bool forceWacViewingFirstOnPublicComputers, bool forceWacViewingFirstOnPrivateComputers, bool wacViewingOnPublicComputersEnabled, bool wacViewingOnPrivateComputersEnabled, bool forceWebReadyDocumentViewingFirstOnPublicComputers, bool forceWebReadyDocumentViewingFirstOnPrivateComputers, bool webReadyDocumentViewingOnPublicComputersEnabled, bool webReadyDocumentViewingOnPrivateComputersEnabled, string[] webReadyFileTypes, string[] webReadyMimeTypes, string[] webReadyDocumentViewingSupportedFileTypes, string[] webReadyDocumentViewingSupportedMimeTypes, bool webReadyDocumentViewingForAllSupportedTypes)
 {
     this.treatUnknownTypeAs = treatUnknownTypeAs;
     this.directFileAccessOnPublicComputersEnabled            = directFileAccessOnPublicComputersEnabled;
     this.directFileAccessOnPrivateComputersEnabled           = directFileAccessOnPrivateComputersEnabled;
     this.forceWacViewingFirstOnPublicComputers               = forceWacViewingFirstOnPublicComputers;
     this.forceWacViewingFirstOnPrivateComputers              = forceWacViewingFirstOnPrivateComputers;
     this.wacViewingOnPublicComputersEnabled                  = wacViewingOnPublicComputersEnabled;
     this.wacViewingOnPrivateComputersEnabled                 = wacViewingOnPrivateComputersEnabled;
     this.forceWebReadyDocumentViewingFirstOnPublicComputers  = forceWebReadyDocumentViewingFirstOnPublicComputers;
     this.forceWebReadyDocumentViewingFirstOnPrivateComputers = forceWebReadyDocumentViewingFirstOnPrivateComputers;
     this.webReadyDocumentViewingOnPublicComputersEnabled     = webReadyDocumentViewingOnPublicComputersEnabled;
     this.webReadyDocumentViewingOnPrivateComputersEnabled    = webReadyDocumentViewingOnPrivateComputersEnabled;
     this.webReadyDocumentViewingForAllSupportedTypes         = webReadyDocumentViewingForAllSupportedTypes;
     this.webReadyFileTypes = webReadyFileTypes;
     Array.Sort <string>(this.webReadyFileTypes);
     this.webReadyMimeTypes = webReadyMimeTypes;
     Array.Sort <string>(this.webReadyMimeTypes);
     this.webReadyDocumentViewingSupportedFileTypes = webReadyDocumentViewingSupportedFileTypes;
     Array.Sort <string>(this.webReadyDocumentViewingSupportedFileTypes);
     this.webReadyDocumentViewingSupportedMimeTypes = webReadyDocumentViewingSupportedMimeTypes;
     Array.Sort <string>(this.webReadyDocumentViewingSupportedMimeTypes);
     this.fileTypeLevels     = AttachmentPolicy.LoadDictionary(blockFileTypes, forceSaveFileTypes, allowFileTypes);
     this.mimeTypeLevels     = AttachmentPolicy.LoadDictionary(blockMimeTypes, forceSaveMimeTypes, allowMimeTypes);
     this.blockedFileTypes   = blockFileTypes;
     this.blockedMimeTypes   = blockMimeTypes;
     this.forceSaveFileTypes = forceSaveFileTypes;
     this.forceSaveMimeTypes = forceSaveMimeTypes;
     this.allowedFileTypes   = allowFileTypes;
     this.allowedMimeTypes   = allowMimeTypes;
     this.policyData         = new OwaAttachmentPolicyData
     {
         AllowFileTypes = this.allowedFileTypes,
         AllowMimeTypes = this.allowedMimeTypes,
         BlockFileTypes = this.blockedFileTypes,
         BlockMimeTypes = this.blockedMimeTypes,
         DirectFileAccessOnPrivateComputersEnabled = directFileAccessOnPrivateComputersEnabled,
         DirectFileAccessOnPublicComputersEnabled  = directFileAccessOnPublicComputersEnabled,
         ForceSaveFileTypes = forceSaveFileTypes,
         ForceSaveMimeTypes = forceSaveMimeTypes,
         ForceWacViewingFirstOnPrivateComputers = forceWacViewingFirstOnPrivateComputers,
         ForceWacViewingFirstOnPublicComputers  = forceWacViewingFirstOnPublicComputers,
         ForceWebReadyDocumentViewingFirstOnPrivateComputers = forceWebReadyDocumentViewingFirstOnPrivateComputers,
         ForceWebReadyDocumentViewingFirstOnPublicComputers  = forceWebReadyDocumentViewingFirstOnPublicComputers,
         TreatUnknownTypeAs = treatUnknownTypeAs.ToString(),
         WacViewingOnPrivateComputersEnabled              = wacViewingOnPrivateComputersEnabled,
         WacViewingOnPublicComputersEnabled               = wacViewingOnPublicComputersEnabled,
         WebReadyDocumentViewingForAllSupportedTypes      = webReadyDocumentViewingForAllSupportedTypes,
         WebReadyDocumentViewingOnPrivateComputersEnabled = webReadyDocumentViewingOnPrivateComputersEnabled,
         WebReadyDocumentViewingOnPublicComputersEnabled  = webReadyDocumentViewingOnPublicComputersEnabled,
         WebReadyDocumentViewingSupportedFileTypes        = webReadyDocumentViewingSupportedFileTypes,
         WebReadyDocumentViewingSupportedMimeTypes        = webReadyDocumentViewingSupportedMimeTypes,
         WebReadyFileTypes = webReadyFileTypes,
         WebReadyMimeTypes = webReadyMimeTypes
     };
 }
        // 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);
        }
        // Token: 0x06000802 RID: 2050 RVA: 0x0001A598 File Offset: 0x00018798
        internal AttachmentPolicyLevel GetLevel(string attachmentType, AttachmentPolicy.TypeSignifier typeSignifier)
        {
            AttachmentPolicyLevel result = AttachmentPolicyLevel.Unknown;

            switch (typeSignifier)
            {
            case AttachmentPolicy.TypeSignifier.File:
                result = AttachmentPolicy.FindLevel(this.fileTypeLevels, attachmentType);
                break;

            case AttachmentPolicy.TypeSignifier.Mime:
                result = AttachmentPolicy.FindLevel(this.mimeTypeLevels, attachmentType);
                break;
            }
            return(result);
        }
 // Token: 0x06000805 RID: 2053 RVA: 0x0001A808 File Offset: 0x00018A08
 internal static WacConfigData ReadAggregatedWacData(UserContext userContext, UserConfigurationManager.IAggregationContext ctx)
 {
     return(UserContextUtilities.ReadAggregatedType <WacConfigData>(ctx, "OWA.WacData", () => AttachmentPolicy.GetWacConfigData(userContext)));
 }
        // Token: 0x06001ACF RID: 6863 RVA: 0x0006569C File Offset: 0x0006389C
        public static WacAttachmentType Execute(CallContext callContext, IStoreSession originalAttachmentSession, IItem originalAttachmentItem, IAttachment originalAttachment, string draftId, string ewsAttachmentId, bool isEdit)
        {
            MdbCache.GetInstance().BeginAsyncUpdate();
            UserContext userContext = UserContextManager.GetUserContext(callContext.HttpContext, callContext.EffectiveCaller, true);

            if (userContext == null)
            {
                throw new OwaInvalidRequestException("Unable to determine user context.");
            }
            if (!userContext.IsWacEditingEnabled)
            {
                isEdit = false;
            }
            ConfigurationContext configurationContext = new ConfigurationContext(userContext);
            AttachmentPolicy     attachmentPolicy     = configurationContext.AttachmentPolicy;
            bool isPublicLogon = userContext.IsPublicLogon;

            if (!attachmentPolicy.GetWacViewingEnabled(isPublicLogon))
            {
                throw new OwaOperationNotSupportedException("WAC viewing not enabled for the current user");
            }
            MailboxSession mailboxSession = null;
            StoreObjectId  draftObjectId  = null;

            if (draftId != null)
            {
                IdAndSession idAndSession = GetWacAttachmentInfo.GetIdAndSession(callContext, draftId, false);
                mailboxSession = (idAndSession.Session as MailboxSession);
                draftObjectId  = StoreId.EwsIdToStoreObjectId(draftId);
                if (mailboxSession == null)
                {
                    throw new OwaOperationNotSupportedException("We need a MailboxSession to create the draft, but this a " + idAndSession.Session.GetType().Name);
                }
            }
            string text = originalAttachmentSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString();
            string primarySmtpAddress        = callContext.EffectiveCaller.PrimarySmtpAddress;
            RequestDetailsLogger protocolLog = callContext.ProtocolLog;

            protocolLog.Set(GetWacAttachmentInfoMetadata.LogonSmtpAddress, primarySmtpAddress);
            protocolLog.Set(GetWacAttachmentInfoMetadata.MailboxSmtpAddress, text);
            protocolLog.Set(GetWacAttachmentInfoMetadata.Edit, isEdit);
            protocolLog.Set(GetWacAttachmentInfoMetadata.Extension, originalAttachment.FileExtension);
            protocolLog.Set(GetWacAttachmentInfoMetadata.DraftProvided, draftId != null);
            string                 displayName = callContext.AccessingPrincipal.MailboxInfo.DisplayName;
            XSOFactory             factory     = new XSOFactory();
            AttachmentDataProvider defaultUploadDataProvider = new AttachmentDataProviderManager().GetDefaultUploadDataProvider(callContext);
            IReferenceAttachment   referenceAttachment       = originalAttachment as IReferenceAttachment;

            if (referenceAttachment != null)
            {
                GetWacAttachmentInfo.LogReferenceAttachmentProperties(protocolLog, referenceAttachment.ProviderEndpointUrl, GetWacAttachmentInfoMetadata.OriginalReferenceAttachmentServiceUrl, referenceAttachment.AttachLongPathName, GetWacAttachmentInfoMetadata.OriginalReferenceAttachmentUrl);
            }
            if (defaultUploadDataProvider != null)
            {
                protocolLog.Set(GetWacAttachmentInfoMetadata.AttachmentDataProvider, defaultUploadDataProvider.ToString());
            }
            WacAttachmentType wacAttachmentType;

            try
            {
                using (GetWacAttachmentInfo.Implementation implementation = new GetWacAttachmentInfo.Implementation(defaultUploadDataProvider, factory, originalAttachmentSession, originalAttachmentSession.MailboxOwner.ModernGroupType, originalAttachmentItem, originalAttachment, ewsAttachmentId, mailboxSession, draftObjectId, isEdit, displayName, (IStoreSession session, StoreId itemId, AttachmentId attachmentId) => new IdAndSession(itemId, (StoreSession)session)
                {
                    AttachmentIds =
                    {
                        attachmentId
                    }
                }.GetConcatenatedId().Id))
                {
                    implementation.Execute();
                    protocolLog.Set(GetWacAttachmentInfoMetadata.OriginalAttachmentType, implementation.OriginalAttachmentType);
                    protocolLog.Set(GetWacAttachmentInfoMetadata.ResultAttachmentType, implementation.ResultAttachmentType);
                    protocolLog.Set(GetWacAttachmentInfoMetadata.ResultAttachmentCreation, implementation.ResultAttachmentCreation);
                    if (implementation.ResultAttachmentType == AttachmentType.Reference)
                    {
                        IMailboxInfo mailboxInfo       = originalAttachmentSession.MailboxOwner.MailboxInfo;
                        string       mailboxAddress    = mailboxInfo.PrimarySmtpAddress.ToString();
                        StoreId      id                = originalAttachmentItem.Id;
                        BaseItemId   itemIdFromStoreId = IdConverter.GetItemIdFromStoreId(id, new MailboxId(mailboxInfo.MailboxGuid));
                        string       exchangeSessionId = WacUtilities.GetExchangeSessionId(default(Guid).ToString());
                        protocolLog.Set(GetWacAttachmentInfoMetadata.ExchangeSessionId, exchangeSessionId);
                        wacAttachmentType = GetWacAttachmentInfo.GetResultForReferenceAttachment(callContext, userContext, implementation, defaultUploadDataProvider, mailboxAddress, itemIdFromStoreId, originalAttachment.FileName, isEdit, displayName, exchangeSessionId, protocolLog);
                    }
                    else
                    {
                        if (implementation.ResultAttachmentType != AttachmentType.Stream)
                        {
                            throw new OwaNotSupportedException("Unsupported attachment type " + implementation.ResultAttachmentType);
                        }
                        AttachmentIdType ewsAttachmentIdType = GetWacAttachmentInfo.GetEwsAttachmentIdType(callContext, implementation.ResultItemId, implementation.ResultAttachmentId);
                        wacAttachmentType = GetWacAttachmentInfo.GetResultForStreamAttachment(callContext, userContext, configurationContext, attachmentPolicy, isPublicLogon, Thread.CurrentThread.CurrentCulture.Name, isEdit, (IStreamAttachment)implementation.ResultAttachment, implementation.ResultAttachmentExtension, ewsAttachmentIdType, implementation.ResultIsInDraft, implementation.ResultStoreSession, text, originalAttachmentSession.MailboxOwner.MailboxInfo.IsArchive);
                    }
                }
            }
            catch (ServerException exception)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception, WacAttachmentStatus.UploadFailed);
            }
            catch (GetWacAttachmentInfo.AttachmentUploadException exception2)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception2, WacAttachmentStatus.UploadFailed);
            }
            catch (RightsManagementPermanentException exception3)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception3, WacAttachmentStatus.ProtectedByUnsupportedIrm);
            }
            catch (AttachmentProtectionException exception4)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception4, WacAttachmentStatus.ProtectedByUnsupportedIrm);
            }
            catch (ObjectNotFoundException exception5)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception5, WacAttachmentStatus.NotFound);
            }
            catch (OwaInvalidRequestException exception6)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception6, WacAttachmentStatus.InvalidRequest);
            }
            catch (WacDiscoveryFailureException exception7)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception7, WacAttachmentStatus.WacDiscoveryFailed);
            }
            catch (WebException exception8)
            {
                wacAttachmentType = GetWacAttachmentInfo.HandleException(protocolLog, isEdit, exception8, WacAttachmentStatus.AttachmentDataProviderError);
            }
            if (wacAttachmentType == null)
            {
                throw new OwaInvalidOperationException("There is no reason known for code to reach here without throwing an unhandled exception elsewhere");
            }
            protocolLog.Set(GetWacAttachmentInfoMetadata.Status, wacAttachmentType.Status.ToString());
            return(wacAttachmentType);
        }
Beispiel #7
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: 0x06001AD7 RID: 6871 RVA: 0x00065FAC File Offset: 0x000641AC
        private static WacAttachmentType GetResultForStreamAttachment(CallContext callContext, UserContext userContext, ConfigurationContext configurationContext, AttachmentPolicy attachmentPolicy, bool isPublicLogon, string cultureName, bool isEdit, IStreamAttachment attachment, string attachmentExtension, AttachmentIdType attachmentIdType, bool isInDraft, IStoreSession storeSession, string mailboxSmtpAddress, bool isArchive)
        {
            WacFileRep  wacFileRep = GetWacAttachmentInfo.CreateWacFileRep(callContext, configurationContext, attachmentPolicy, isPublicLogon, isEdit, isArchive);
            HttpRequest request    = callContext.HttpContext.Request;
            string      text;
            string      arg;

            GetWacAttachmentInfo.GenerateWopiSrcUrl(request, wacFileRep, mailboxSmtpAddress, out text, out arg);
            if (text == null)
            {
                throw new OwaInvalidOperationException("WOPI URL is null.");
            }
            string      id                = attachmentIdType.Id;
            TokenResult oauthToken        = GetWacAttachmentInfo.GetOAuthToken(id, userContext, mailboxSmtpAddress, text);
            string      exchangeSessionId = WacUtilities.GetExchangeSessionId(oauthToken.TokenString);

            callContext.ProtocolLog.Set(GetWacAttachmentInfoMetadata.ExchangeSessionId, exchangeSessionId);
            SecurityIdentifier effectiveCallerSid = callContext.EffectiveCallerSid;

            CachedAttachmentInfo.GetInstance(mailboxSmtpAddress, id, exchangeSessionId, effectiveCallerSid, cultureName);
            string wacUrl = GetWacAttachmentInfo.GetWacUrl(isEdit, cultureName, attachmentExtension);

            if (string.IsNullOrEmpty(wacUrl))
            {
                throw new OwaInvalidRequestException(string.Format("Wac Base Url is null for this given extension {0} and culture {1}", attachmentExtension, cultureName));
            }
            new Uri(wacUrl);
            string format = "{0}WOPISrc={1}&access_token={2}";
            string arg2   = HttpUtility.UrlEncode(oauthToken.TokenString);
            string text2  = string.Format(format, wacUrl, HttpUtility.UrlEncode(text), arg2);
            string value  = string.Format(format, wacUrl, arg, arg2);

            callContext.ProtocolLog.Set(GetWacAttachmentInfoMetadata.WacUrl, value);
            if (!Uri.IsWellFormedUriString(text2, UriKind.Absolute))
            {
                throw new OwaInvalidOperationException("The WAC Iframe URL that was generated is not a well formed URI: " + text2);
            }
            return(new WacAttachmentType
            {
                AttachmentId = attachmentIdType,
                IsEdit = isEdit,
                IsInDraft = isInDraft,
                WacUrl = text2,
                Status = WacAttachmentStatus.Success
            });
        }
        // Token: 0x06001AD8 RID: 6872 RVA: 0x00066110 File Offset: 0x00064310
        private static WacFileRep CreateWacFileRep(CallContext callContext, ConfigurationContext configurationContext, AttachmentPolicy attachmentPolicy, bool isPublicLogon, bool isEdit, bool isArchive)
        {
            bool directFileAccessEnabled = attachmentPolicy.GetDirectFileAccessEnabled(isPublicLogon);
            bool externalServicesEnabled = configurationContext.IsFeatureEnabled(Feature.WacExternalServicesEnabled);
            bool wacOMEXEnabled          = configurationContext.IsFeatureEnabled(Feature.WacOMEXEnabled);

            return(new WacFileRep(callContext.EffectiveCallerSid, directFileAccessEnabled, externalServicesEnabled, wacOMEXEnabled, isEdit, isArchive));
        }
Beispiel #10
0
        internal void SetWacEditingEnabled(WacConfigData wacData)
        {
            bool flag = AttachmentPolicy.IsAttachmentDataProviderAvailable(wacData);

            this.isWacEditingEnabled = new bool?(wacData.IsWacEditingEnabled && flag);
        }
Beispiel #11
0
 internal static AttachmentHandler.IAttachmentPolicyChecker CreateInstance(AttachmentPolicy policy)
 {
     return(new AttachmentPolicyChecker(policy));
 }
Beispiel #12
0
 private AttachmentPolicyChecker(AttachmentPolicy policy)
 {
     this.policy = policy;
 }
Beispiel #13
0
        // Token: 0x06000959 RID: 2393 RVA: 0x0001EE24 File Offset: 0x0001D024
        private VdirConfiguration()
        {
            AttachmentPolicy attachmentPolicy = new AttachmentPolicy(new StringArrayAppSettingsEntry("BlockFileTypes", new string[]
            {
                ".vsmacros",
                ".msh2xml",
                ".msh1xml",
                ".ps2xml",
                ".ps1xml",
                ".mshxml",
                ".mhtml",
                ".psc2",
                ".psc1",
                ".msh2",
                ".msh1",
                ".aspx",
                ".xml",
                ".wsh",
                ".wsf",
                ".wsc",
                ".vsw",
                ".vst",
                ".vss",
                ".vbs",
                ".vbe",
                ".url",
                ".tmp",
                ".shs",
                ".shb",
                ".sct",
                ".scr",
                ".scf",
                ".reg",
                ".pst",
                ".ps2",
                ".ps1",
                ".prg",
                ".prf",
                ".plg",
                ".pif",
                ".pcd",
                ".ops",
                ".mst",
                ".msp",
                ".msi",
                ".msh",
                ".msc",
                ".mht",
                ".mdz",
                ".mdw",
                ".mdt",
                ".mde",
                ".mdb",
                ".mda",
                ".maw",
                ".mav",
                ".mau",
                ".mat",
                ".mas",
                ".mar",
                ".maq",
                ".mam",
                ".mag",
                ".maf",
                ".mad",
                ".lnk",
                ".ksh",
                ".jse",
                ".its",
                ".isp",
                ".ins",
                ".inf",
                ".htc",
                ".hta",
                ".hlp",
                ".fxp",
                ".exe",
                ".der",
                ".csh",
                ".crt",
                ".cpl",
                ".com",
                ".cmd",
                ".chm",
                ".cer",
                ".bat",
                ".bas",
                ".asx",
                ".asp",
                ".app",
                ".adp",
                ".ade",
                ".ws",
                ".vb",
                ".js"
            }, null).Value, new StringArrayAppSettingsEntry("BlockMimeTypes", new string[]
            {
                "application/x-javascript",
                "application/javascript",
                "application/msaccess",
                "x-internet-signup",
                "text/javascript",
                "application/xml",
                "application/prg",
                "application/hta",
                "text/scriplet",
                "text/xml"
            }, null).Value, new StringArrayAppSettingsEntry("ForceSaveFileTypes", new string[]
            {
                ".vsmacros",
                ".msh2xml",
                ".msh1xml",
                ".ps2xml",
                ".ps1xml",
                ".mshxml",
                ".mhtml",
                ".psc2",
                ".psc1",
                ".msh2",
                ".msh1",
                ".aspx",
                ".xml",
                ".wsh",
                ".wsf",
                ".wsc",
                ".vsw",
                ".vst",
                ".vss",
                ".vbs",
                ".vbe",
                ".url",
                ".tmp",
                ".shs",
                ".shb",
                ".sct",
                ".scr",
                ".scf",
                ".reg",
                ".pst",
                ".ps2",
                ".ps1",
                ".prg",
                ".prf",
                ".plg",
                ".pif",
                ".pcd",
                ".ops",
                ".mst",
                ".msp",
                ".msi",
                ".msh",
                ".msc",
                ".mht",
                ".mdz",
                ".mdw",
                ".mdt",
                ".mde",
                ".mdb",
                ".mda",
                ".maw",
                ".mav",
                ".mau",
                ".mat",
                ".mas",
                ".mar",
                ".maq",
                ".mam",
                ".mag",
                ".maf",
                ".mad",
                ".lnk",
                ".ksh",
                ".jse",
                ".its",
                ".isp",
                ".ins",
                ".inf",
                ".htc",
                ".hta",
                ".hlp",
                ".fxp",
                ".exe",
                ".der",
                ".csh",
                ".crt",
                ".cpl",
                ".com",
                ".cmd",
                ".chm",
                ".cer",
                ".bat",
                ".bas",
                ".asx",
                ".asp",
                ".app",
                ".adp",
                ".ade",
                ".ws",
                ".vb",
                ".js"
            }, null).Value, new StringArrayAppSettingsEntry("ForceSaveMimeTypes", new string[]
            {
                "Application/x-shockwave-flash",
                "Application/octet-stream",
                "Application/futuresplash",
                "Application/x-director"
            }, null).Value, new StringArrayAppSettingsEntry("AllowFileTypes", new string[]
            {
                ".rpmsg",
                ".xlsx",
                ".xlsm",
                ".xlsb",
                ".pptx",
                ".pptm",
                ".ppsx",
                ".ppsm",
                ".docx",
                ".docm",
                ".zip",
                ".xls",
                ".wmv",
                ".wma",
                ".wav",
                ".vsd",
                ".txt",
                ".tif",
                ".rtf",
                ".pub",
                ".ppt",
                ".png",
                ".pdf",
                ".one",
                ".mp3",
                ".jpg",
                ".gif",
                ".doc",
                ".bmp",
                ".avi"
            }, null).Value, new StringArrayAppSettingsEntry("AllowMimeTypes", new string[0], null).Value, (AttachmentPolicyLevel)Enum.Parse(typeof(AttachmentPolicyLevel), new StringAppSettingsEntry("ActionForUnknownFileAndMIMETypes", "ForceSave", null).Value), new BoolAppSettingsEntry("DirectFileAccessOnPublicComputersEnabled", true, null).Value, new BoolAppSettingsEntry("DirectFileAccessOnPrivateComputersEnabled", true, null).Value, new BoolAppSettingsEntry("ForceWacViewingFirstOnPublicComputers", false, null).Value, new BoolAppSettingsEntry("ForceWacViewingFirstOnPrivateComputers", false, null).Value, new BoolAppSettingsEntry("WacViewingOnPublicComputersEnabled", true, null).Value, new BoolAppSettingsEntry("WacViewingOnPrivateComputersEnabled", true, null).Value, new BoolAppSettingsEntry("ForceWebReadyDocumentViewingFirstOnPublicComputers", false, null).Value, new BoolAppSettingsEntry("ForceWebReadyDocumentViewingFirstOnPrivateComputers", false, null).Value, new BoolAppSettingsEntry("WebReadyDocumentViewingOnPublicComputersEnabled", true, null).Value, new BoolAppSettingsEntry("WebReadyDocumentViewingOnPrivateComputersEnabled", true, null).Value, new StringArrayAppSettingsEntry("WebReadyFileTypes", new string[]
            {
                ".xlsx",
                ".xlsm",
                ".xlsb",
                ".pptx",
                ".pptm",
                ".ppsx",
                ".ppsm",
                ".docx",
                ".docm",
                ".xls",
                ".rtf",
                ".pdf"
            }, null).Value, new StringArrayAppSettingsEntry("WebReadyMimeTypes", new string[0], null).Value, new StringArrayAppSettingsEntry("WebReadyDocumentViewingSupportedFileTypes", new string[]
            {
                ".xlsx",
                ".xlsm",
                ".xlsb",
                ".pptx",
                ".pptm",
                ".ppsx",
                ".ppsm",
                ".docx",
                ".docm",
                ".xls",
                ".rtf",
                ".pdf"
            }, null).Value, new StringArrayAppSettingsEntry("WebReadyDocumentViewingSupportedMimeTypes", new string[0], null).Value, new BoolAppSettingsEntry("WebReadyDocumentViewingForAllSupportedTypes", false, null).Value);

            base.AttachmentPolicy = attachmentPolicy;
            WebBeaconFilterLevels value = (WebBeaconFilterLevels)Enum.Parse(typeof(WebBeaconFilterLevels), new StringAppSettingsEntry("FilterWebBeaconsAndHtmlForms", "UserFilterChoice", null).Value);

            this.filterWebBeaconsAndHtmlForms = VdirConfiguration.GetWebBeaconFilterLevel(new WebBeaconFilterLevels?(value));
            base.DefaultTheme               = new StringAppSettingsEntry("DefaultTheme", string.Empty, null).Value;
            base.SegmentationFlags          = (ulong)Enum.Parse(typeof(Feature), new StringAppSettingsEntry("SegmentationFlags", "All", null).Value);
            base.OutboundCharset            = (OutboundCharsetOptions)Enum.Parse(typeof(OutboundCharsetOptions), new StringAppSettingsEntry("OutboundCharset", "AutoDetect", null).Value);
            base.UseGB18030                 = new BoolAppSettingsEntry("UseGB18030", false, null).Value;
            base.UseISO885915               = new BoolAppSettingsEntry("UseISO885915", false, null).Value;
            base.InstantMessagingType       = (InstantMessagingTypeOptions)Enum.Parse(typeof(InstantMessagingTypeOptions), new StringAppSettingsEntry("InstantMessagingType", "Ocs", null).Value);
            base.InstantMessagingEnabled    = new BoolAppSettingsEntry("InstantMessagingEnabled", true, null).Value;
            base.AllowOfflineOn             = (AllowOfflineOnEnum)Enum.Parse(typeof(AllowOfflineOnEnum), new StringAppSettingsEntry("AllowOfflineOn", "AllComputers", null).Value);
            this.formsAuthenticationEnabled = new BoolAppSettingsEntry("FormsAuthenticationEnabled", true, null).Value;
            base.RecoverDeletedItemsEnabled = new BoolAppSettingsEntry("RecoverDeletedItemsEnabled", true, null).Value;
        }
Beispiel #14
0
        // Token: 0x0600095A RID: 2394 RVA: 0x0001FACC File Offset: 0x0001DCCC
        private VdirConfiguration(ITopologyConfigurationSession session, ADOwaVirtualDirectory owaVirtualDirectory)
        {
            AttachmentPolicyLevel treatUnknownTypeAs = ConfigurationBase.AttachmentActionToPolicyLevel(owaVirtualDirectory.ActionForUnknownFileAndMIMETypes);
            AttachmentPolicy      attachmentPolicy   = new AttachmentPolicy(owaVirtualDirectory.BlockedFileTypes.ToArray(), owaVirtualDirectory.BlockedMimeTypes.ToArray(), owaVirtualDirectory.ForceSaveFileTypes.ToArray(), owaVirtualDirectory.ForceSaveMimeTypes.ToArray(), owaVirtualDirectory.AllowedFileTypes.ToArray(), owaVirtualDirectory.AllowedMimeTypes.ToArray(), treatUnknownTypeAs, owaVirtualDirectory.DirectFileAccessOnPublicComputersEnabled.Value, owaVirtualDirectory.DirectFileAccessOnPrivateComputersEnabled.Value, owaVirtualDirectory.ForceWacViewingFirstOnPublicComputers.Value, owaVirtualDirectory.ForceWacViewingFirstOnPrivateComputers.Value, owaVirtualDirectory.WacViewingOnPublicComputersEnabled.Value, owaVirtualDirectory.WacViewingOnPrivateComputersEnabled.Value, owaVirtualDirectory.ForceWebReadyDocumentViewingFirstOnPublicComputers.Value, owaVirtualDirectory.ForceWebReadyDocumentViewingFirstOnPrivateComputers.Value, owaVirtualDirectory.WebReadyDocumentViewingOnPublicComputersEnabled.Value, owaVirtualDirectory.WebReadyDocumentViewingOnPrivateComputersEnabled.Value, owaVirtualDirectory.WebReadyFileTypes.ToArray(), owaVirtualDirectory.WebReadyMimeTypes.ToArray(), owaVirtualDirectory.WebReadyDocumentViewingSupportedFileTypes.ToArray(), owaVirtualDirectory.WebReadyDocumentViewingSupportedMimeTypes.ToArray(), owaVirtualDirectory.WebReadyDocumentViewingForAllSupportedTypes.Value);

            this.formsAuthenticationEnabled   = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Fba);
            this.windowsAuthenticationEnabled = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.WindowsIntegrated);
            this.basicAuthenticationEnabled   = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Basic);
            this.digestAuthenticationEnabled  = owaVirtualDirectory.InternalAuthenticationMethods.Contains(AuthenticationMethod.Digest);
            base.AttachmentPolicy             = attachmentPolicy;
            this.filterWebBeaconsAndHtmlForms = VdirConfiguration.GetWebBeaconFilterLevel(owaVirtualDirectory.FilterWebBeaconsAndHtmlForms);
            base.DefaultTheme = owaVirtualDirectory.DefaultTheme;
            int segmentationBits  = (int)owaVirtualDirectory[ADOwaVirtualDirectorySchema.ADMailboxFolderSet];
            int segmentationBits2 = (int)owaVirtualDirectory[ADOwaVirtualDirectorySchema.ADMailboxFolderSet2];

            base.SegmentationFlags = ConfigurationBase.SetSegmentationFlags(segmentationBits, segmentationBits2);
            if (owaVirtualDirectory.OutboundCharset != null)
            {
                base.OutboundCharset = owaVirtualDirectory.OutboundCharset.Value;
            }
            if (owaVirtualDirectory.UseGB18030 != null && owaVirtualDirectory.UseGB18030.Value)
            {
                base.UseGB18030 = true;
            }
            else
            {
                base.UseGB18030 = false;
            }
            if (owaVirtualDirectory.UseISO885915 != null && owaVirtualDirectory.UseISO885915.Value)
            {
                base.UseISO885915 = true;
            }
            else
            {
                base.UseISO885915 = false;
            }
            base.InstantMessagingEnabled  = (owaVirtualDirectory.InstantMessagingEnabled ?? false);
            base.InstantMessagingType     = (owaVirtualDirectory.InstantMessagingType ?? InstantMessagingTypeOptions.None);
            base.InstantMessagingEnabled &= (base.InstantMessagingType == InstantMessagingTypeOptions.Ocs);
            if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.UseVdirConfigForInstantMessaging.Enabled)
            {
                this.instantMessagingServerName            = owaVirtualDirectory.InstantMessagingServerName;
                this.instantMessagingCertificateThumbprint = owaVirtualDirectory.InstantMessagingCertificateThumbprint;
                if (string.IsNullOrWhiteSpace(this.instantMessagingServerName))
                {
                    Organization orgContainer = session.GetOrgContainer();
                    ProtocolConnectionSettings sipaccessService = orgContainer.SIPAccessService;
                    if (sipaccessService == null)
                    {
                        this.instantMessagingServerName = string.Empty;
                    }
                    else
                    {
                        this.instantMessagingServerName = sipaccessService.Hostname.ToString();
                    }
                }
            }
            base.AllowOfflineOn = owaVirtualDirectory.AllowOfflineOn;
            base.PlacesEnabled  = (owaVirtualDirectory.PlacesEnabled != null && owaVirtualDirectory.PlacesEnabled.Value);
            base.WeatherEnabled = (owaVirtualDirectory.WeatherEnabled != null && owaVirtualDirectory.WeatherEnabled.Value);
            base.AllowCopyContactsToDeviceAddressBook = (owaVirtualDirectory.AllowCopyContactsToDeviceAddressBook != null && owaVirtualDirectory.AllowCopyContactsToDeviceAddressBook.Value);
            base.RecoverDeletedItemsEnabled           = (owaVirtualDirectory.RecoverDeletedItemsEnabled != null && owaVirtualDirectory.RecoverDeletedItemsEnabled.Value);
            this.expirationTime = DateTime.UtcNow + VdirConfiguration.expirationPeriod;
        }