Exemplo n.º 1
0
        private int GetTemplateIndex()
        {
            if (!DesignMode && Page != null && Page.Request.IsAuthenticated)
            {
                IPrincipal user           = LoginUtil.GetUser(this);
                int        roleGroupIndex = -1;

                // Unlikely but possible for Page.Request.IsAuthenticated to be true and
                // user to be null.
                if (user != null)
                {
                    roleGroupIndex = RoleGroups.GetMatchingRoleGroupInternal(user);
                }

                if (roleGroupIndex >= 0)
                {
                    return(roleGroupIndex + roleGroupStartingIndex);
                }
                else
                {
                    return(loggedInTemplateIndex);
                }
            }
            else
            {
                return(anonymousTemplateIndex);
            }
        }
Exemplo n.º 2
0
        private int GetTemplateIndex()
        {
            if ((base.DesignMode || (this.Page == null)) || !this.Page.Request.IsAuthenticated)
            {
                return(0);
            }
            IPrincipal user = LoginUtil.GetUser(this);
            int        matchingRoleGroupInternal = -1;

            if (user != null)
            {
                matchingRoleGroupInternal = this.RoleGroups.GetMatchingRoleGroupInternal(user);
            }
            if (matchingRoleGroupInternal >= 0)
            {
                return(matchingRoleGroupInternal + 2);
            }
            return(1);
        }