Exemplo n.º 1
0
        private bool CanSeeUnpublishedContents()
        {
            var context = System.Web.HttpContext.Current;

            if (context == null)
            {
                return(false);
            }

            string token = context.Request.QueryString["previewToken"];

            if (String.IsNullOrEmpty(token))
            {
                return(false);
            }

            Core.Services.SecurityService security = new Core.Services.SecurityService();
            var admCMS = new Groups.ADM_CMS();
            var admSEC = new Core.Groups.ADM_SEC();

            Core.User u = security.GetUserByAuthToken(token);
            if (u == null)
            {
                return(false);
            }

            string[] roles = security.GetUserRoles(u);
            return(roles.Contains(admCMS.UserGroupUId) || roles.Contains(admSEC.UserGroupUId));
        }
Exemplo n.º 2
0
        private bool GetShowOnlyPublished(System.Web.HttpApplication app, string url)
        {
            if (app.Request.QueryString["previewToken"] == null)
            {
                return(true);
            }

            //Remove token from url
            string token = app.Request.QueryString["previewToken"].ToString();

            Core.Services.SecurityService security = new Core.Services.SecurityService();

            User u = security.GetUserByAuthToken(token);

            if (u == null)
            {
                return(true);
            }

            string[] roles = security.GetUserRoles(u);
            return(!roles.Contains(ADM_CMS_group.UserGroupUId) && !roles.Contains(AMD_SEC_group.UserGroupUId));
        }
Exemplo n.º 3
0
        private bool CanSeeUnpublishedContents()
        {
            var context = System.Web.HttpContext.Current;
            if (context == null)
                return false;

            string token = context.Request.QueryString["previewToken"];
            if (String.IsNullOrEmpty(token))
                return false;

            Core.Services.SecurityService security = new Core.Services.SecurityService();
            var admCMS = new Groups.ADM_CMS();
            var admSEC = new Core.Groups.ADM_SEC();

            Core.User u = security.GetUserByAuthToken(token);
            if (u == null)
                return false;

            string[] roles = security.GetUserRoles(u);
            return roles.Contains(admCMS.UserGroupUId) || roles.Contains(admSEC.UserGroupUId);
        }