// 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));
        }
예제 #2
0
        private Theme LoadUserTheme()
        {
            ConfigurationContext configurationContext = new ConfigurationContext(this);
            Theme result;

            if (configurationContext.IsFeatureEnabled(Feature.Themes))
            {
                string text = null;
                try
                {
                    base.LockAndReconnectMailboxSession(30000);
                    UserConfigurationPropertyDefinition propertyDefinition = UserOptionPropertySchema.Instance.GetPropertyDefinition(UserConfigurationPropertyId.ThemeStorageId);
                    UserOptionsType userOptionsType = new UserOptionsType();
                    userOptionsType.Load(base.MailboxSession, new UserConfigurationPropertyDefinition[]
                    {
                        propertyDefinition
                    });
                    text = userOptionsType.ThemeStorageId;
                }
                catch (Exception)
                {
                    ExTraceGlobals.ThemesTracer.TraceError(0L, "Failed to find the user's theme from UserOptions");
                }
                finally
                {
                    base.UnlockAndDisconnectMailboxSession();
                }
                if (string.IsNullOrEmpty(text))
                {
                    result = this.DefaultTheme;
                }
                else
                {
                    uint idFromStorageId = ThemeManagerFactory.GetInstance(this.CurrentOwaVersion).GetIdFromStorageId(text);
                    if (idFromStorageId == 4294967295U)
                    {
                        result = this.DefaultTheme;
                    }
                    else
                    {
                        result = ThemeManagerFactory.GetInstance(this.CurrentOwaVersion).Themes[(int)((UIntPtr)idFromStorageId)];
                    }
                }
            }
            else
            {
                result = this.DefaultTheme;
            }
            return(result);
        }
예제 #3
0
        // Token: 0x06001BCE RID: 7118 RVA: 0x0006B2E4 File Offset: 0x000694E4
        protected override SetUserThemeResponse InternalExecute()
        {
            UserContext          userContext          = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true);
            ConfigurationContext configurationContext = new ConfigurationContext(userContext);
            SetUserThemeResponse setUserThemeResponse = new SetUserThemeResponse
            {
                OwaSuccess  = false,
                O365Success = false
            };

            if (!configurationContext.IsFeatureEnabled(Feature.Themes) || string.IsNullOrEmpty(this.request.ThemeId))
            {
                return(setUserThemeResponse);
            }
            uint idFromStorageId = ThemeManagerFactory.GetInstance(userContext.CurrentOwaVersion).GetIdFromStorageId(this.request.ThemeId);

            this.tracer.TraceDebug <uint>(1L, "SetUserTheme.InternalExecute::id='{0}'", idFromStorageId);
            if (idFromStorageId == 4294967295U)
            {
                throw new OwaInvalidOperationException("The theme doesn't exist any more on the server");
            }
            string userPrincipalName = userContext.LogonIdentity.GetOWAMiniRecipient().UserPrincipalName;

            setUserThemeResponse.O365Success = this.UpdateO365Theme(this.request.ThemeId, userPrincipalName, userContext);
            if (this.request.ThemeId == userContext.DefaultTheme.StorageId)
            {
                this.request.ThemeId = string.Empty;
            }
            UserConfigurationPropertyDefinition propertyDefinition = UserOptionPropertySchema.Instance.GetPropertyDefinition(UserConfigurationPropertyId.ThemeStorageId);

            new UserOptionsType
            {
                ThemeStorageId = this.request.ThemeId
            }.Commit(base.CallContext, new UserConfigurationPropertyDefinition[]
            {
                propertyDefinition
            });
            setUserThemeResponse.OwaSuccess = true;
            userContext.ClearCachedTheme();
            return(setUserThemeResponse);
        }
        public static bool IsDownLevelClient(HttpContext httpContext, bool avoidUserContextAccess = false)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext cannot be null");
            }
            HttpCookie httpCookie = httpContext.Request.Cookies["PALEnabled"];

            if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
            {
                return(false);
            }
            if (httpContext.Items.Contains("IsDownLevelClient"))
            {
                return((bool)httpContext.Items["IsDownLevelClient"]);
            }
            if (Utility.IsResourceRequest(httpContext.Request.Url.LocalPath))
            {
                avoidUserContextAccess = true;
            }
            bool flag  = false;
            bool flag2 = false;
            bool flag3 = true;
            bool isAndroidPremiumEnabled = false;

            if (httpContext.User != null && httpContext.User.Identity.IsAuthenticated && !avoidUserContextAccess)
            {
                UserContext userContext = UserContextManager.GetMailboxContext(httpContext, null, true) as UserContext;
                if (userContext != null)
                {
                    bool flag4 = Culture.GetPreferredCultureInfo(userContext.ExchangePrincipal) != null;
                    if (flag4)
                    {
                        ConfigurationContext configurationContext = new ConfigurationContext(userContext);
                        flag3 = configurationContext.IsFeatureEnabled(Feature.RichClient);
                        flag2 = userContext.IsOptimizedForAccessibility;
                        flag  = true;
                        ExTraceGlobals.CoreCallTracer.TraceDebug(0L, string.Format("isOptimizedForAccessibility: {0}, isRichClientFeatureEnabled: {1}", flag2, flag3));
                    }
                    if (userContext.FeaturesManager.ServerSettings.AndroidPremium.Enabled)
                    {
                        isAndroidPremiumEnabled = true;
                    }
                }
                else
                {
                    ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "userContext is null when process IsDownLevelClient");
                }
            }
            bool flag5 = RequestDispatcherUtilities.IsDownLevelClient(httpContext.Request, flag2, flag3, isAndroidPremiumEnabled);

            if (flag)
            {
                httpContext.Items["IsDownLevelClient"] = flag5;
                ExTraceGlobals.CoreCallTracer.TraceDebug(0L, string.Format("Cache result '{0}' for IsDownLevelClient", flag5));
            }
            else
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug(0L, string.Format("Result '{0}' for IsDownLevelClient is not cached.", flag5));
            }
            return(flag5);
        }