Esempio n. 1
0
        protected override void CreateChildControls()
        {
            Control child = this.Page.LoadControl("~/Controls/FieldControl/" + this.ControlType.ToString() + ".ascx");

            child.ID = "EasyOne2007";
            if (this.IsAdminManage)
            {
                this.Visible = RolePermissions.AccessCheckFieldPermission(OperateCode.ContentFieldInput, DataConverter.CLng(HttpContext.Current.Request.QueryString["ModelId"]), this.FieldName);
            }
            else
            {
                this.Visible = UserPermissions.AccessCheck(OperateCode.ContentFieldInput, DataConverter.CLng(HttpContext.Current.Request.QueryString["ModelId"]), this.FieldName);
            }
            this.m_FieldControl               = (IFieldControl)child;
            this.m_FieldControl.Settings      = this.Settings;
            this.m_FieldControl.EnableNull    = this.EnableNull;
            this.m_FieldControl.FieldAlias    = this.FieldAlias;
            this.m_FieldControl.FieldLevel    = this.FieldLevel;
            this.m_FieldControl.FieldName     = this.FieldName;
            this.m_FieldControl.Tips          = this.Tips;
            this.m_FieldControl.Description   = this.Description;
            this.m_FieldControl.ControlType   = this.ControlType;
            this.m_FieldControl.IsAdminManage = this.IsAdminManage;
            this.m_FieldControl.InitFieldControl();
            this.Controls.Add(child);
        }
        protected void BtnSelectNode_Click(object sender, EventArgs e)
        {
            string str = BasePage.RequestString("Action");

            if (string.IsNullOrEmpty(str))
            {
                str = "add";
            }
            if (string.IsNullOrEmpty(this.HdnNodeId.Value))
            {
                DynamicPage.WriteUserErrMsg("您没有发布信息的权限!", "NavContent.aspx");
            }
            else if (string.IsNullOrEmpty(this.HdnModelId.Value))
            {
                DynamicPage.WriteUserErrMsg("没有选择内容模型!", "NavContent.aspx");
            }
            else
            {
                NodeInfo cacheNodeById = Nodes.GetCacheNodeById(DataConverter.CLng(this.HdnNodeId.Value));
                if (cacheNodeById.IsNull)
                {
                    DynamicPage.WriteUserErrMsg("<li>节点不存在!</li>", "NavContent.aspx");
                }
                else
                {
                    bool flag = UserPermissions.AccessCheck(OperateCode.NodeContentInput, cacheNodeById.NodeId);
                    if (!flag)
                    {
                        string checkStr = UserPermissions.GetRoleNodeId(PEContext.Current.User.RoleId, OperateCode.NodeContentInput, PEContext.Current.User.UserInfo.IsInheritGroupRole ? 1 : 0);
                        string findStr  = cacheNodeById.NodeId.ToString();
                        if ((cacheNodeById.ParentId > 0) && !flag)
                        {
                            findStr = cacheNodeById.ParentPath + "," + cacheNodeById.NodeId.ToString();
                            flag    = StringHelper.FoundCharInArr(checkStr, findStr);
                        }
                    }
                    if (!flag)
                    {
                        DynamicPage.WriteUserErrMsg("您没有此节点的添加权限!", "NavContent.aspx");
                    }
                    if (ModelManager.GetCacheModelById(DataConverter.CLng(this.HdnModelId.Value)).IsEshop)
                    {
                        BasePage.ResponseRedirect(SiteConfig.SiteInfo.VirtualPath + "User/Shop/Product.aspx?nodeId=" + this.HdnNodeId.Value + "&modelId=" + this.HdnModelId.Value + "&Action=" + str);
                    }
                    else
                    {
                        BasePage.ResponseRedirect("Content.aspx?nodeId=" + this.HdnNodeId.Value + "&modelId=" + this.HdnModelId.Value + "&Action=" + str);
                    }
                }
            }
        }
        private void CheckPermission()
        {
            int permissionType;
            ContentPermissionInfo contentPermissionInfoById = PermissionContent.GetContentPermissionInfoById(this.m_GeneralId);

            if (contentPermissionInfoById == null)
            {
                permissionType = 0;
            }
            else
            {
                permissionType = contentPermissionInfoById.PermissionType;
            }
            switch (permissionType)
            {
            case 0:
                switch (this.m_NodeInfo.PurviewType)
                {
                case 1:
                    this.CheckIsAuthenticated();
                    return;

                case 2:
                    this.CheckIsAuthenticated();
                    if (UserPermissions.AccessCheck(OperateCode.NodeContentPreview, this.m_NodeInfo.NodeId))
                    {
                        break;
                    }
                    TemplatePage.WriteErrMsg("您没有查看该页的权限,请与网站管理员联系", "Default.aspx");
                    return;
                }
                return;

            case 1:
                this.CheckIsAuthenticated();
                return;

            case 2:
                this.CheckIsAuthenticated();
                if (!StringHelper.FoundCharInArr(contentPermissionInfoById.ArrGroupId, PEContext.Current.User.GroupId.ToString()))
                {
                    TemplatePage.WriteErrMsg("您没有查看该页的权限,请与网站管理员联系", "Default.aspx");
                }
                break;

            default:
                return;
            }
        }
        public override void OnInitTemplatePage(EventArgs e)
        {
            this.m_Page = BasePage.RequestInt32("page", 0);
            int nodeId = BasePage.RequestInt32("id");

            if (nodeId <= 0)
            {
                TemplatePage.WriteErrMsg("您访问的栏目不存在");
            }
            else
            {
                this.nodeInfo = Nodes.GetCacheNodeById(nodeId);
                if (this.nodeInfo.IsNull)
                {
                    TemplatePage.WriteErrMsg("您访问的栏目不存在!");
                }
                else
                {
                    switch (this.nodeInfo.PurviewType)
                    {
                    case 2:
                        this.CheckIsAuthenticated();
                        if (!UserPermissions.AccessCheck(OperateCode.NodeContentPreview, nodeId))
                        {
                            TemplatePage.WriteErrMsg("您没有查看该页的权限,请与网站管理员联系");
                        }
                        break;
                    }
                    if ((this.m_Page == 0) || (this.m_Page == 1))
                    {
                        base.IsCache   = true;
                        base.CacheKey  = "CK_Page_Category_" + base.Request.QueryString["id"];
                        base.CacheTime = 12 * this.nodeInfo.Settings.CacheTime;
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.m_ModelId = BasePage.RequestInt32("ModelID");
            this.m_NodeId  = BasePage.RequestInt32("NodeID");
            if (!UserPermissions.AccessCheck(OperateCode.NodeContentInput, this.m_NodeId))
            {
                DynamicPage.WriteErrMsg("您没有发表信息的权限");
            }
            bool flag = false;

            foreach (NodesModelTemplateRelationShipInfo info in ModelManager.GetNodesModelTemplateList(this.m_NodeId))
            {
                if (info.ModelId == this.m_ModelId)
                {
                    ModelInfo cacheModelById = ModelManager.GetCacheModelById(info.ModelId);
                    if (!cacheModelById.IsNull && !cacheModelById.IsEshop)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag)
            {
                DynamicPage.WriteErrMsg("<li>您没有发表信息的权限</li>");
            }
            if (!base.IsPostBack)
            {
                IList <FieldInfo> fieldList = Field.GetFieldList(this.m_ModelId, false);
                this.RepContentForm.DataSource = fieldList;
                this.RepContentForm.DataBind();
                if (!this.m_FieldInput)
                {
                    DynamicPage.WriteErrMsg("<li>该模型没有允许添加的字段,请返回从新选择模型!</li>", "AnonymousContent.aspx?NodeID=" + this.m_NodeId.ToString() + "&ModelID=" + this.m_ModelId.ToString());
                }
            }
        }
Esempio n. 6
0
        public bool CheckPermission()
        {
            int  permissionType;
            bool flag = true;
            ContentPermissionInfo contentPermissionInfoById = PermissionContent.GetContentPermissionInfoById(DataConverter.CLng(HttpContext.Current.Request["id"]));

            if (contentPermissionInfoById == null)
            {
                permissionType = 0;
            }
            else
            {
                permissionType = contentPermissionInfoById.PermissionType;
            }
            switch (permissionType)
            {
            case 0:
                switch (this.m_NodeInfo.PurviewType)
                {
                case 1:
                case 2:
                    if (!this.CheckIsAuthenticated())
                    {
                        flag = false;
                    }
                    if (string.IsNullOrEmpty(this.m_ErrMsg))
                    {
                        if (this.m_NodeInfo.ParentId > 0)
                        {
                            if (!UserPermissions.AccessCheck(OperateCode.NodeContentPreview, this.m_NodeInfo.ParentPath + "," + this.m_NodeInfo.NodeId))
                            {
                                flag = false;
                            }
                        }
                        else if (!UserPermissions.AccessCheck(OperateCode.NodeContentPreview, this.m_NodeInfo.NodeId))
                        {
                            flag = false;
                        }
                        if (!flag)
                        {
                            this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_PurviewCheckedErr;
                        }
                    }
                    return(flag);
                }
                return(flag);

            case 1:
                if (!this.CheckIsAuthenticated())
                {
                    flag = false;
                }
                return(flag);

            case 2:
                if (!this.CheckIsAuthenticated())
                {
                    flag = false;
                }
                if (!StringHelper.FoundCharInArr(contentPermissionInfoById.ArrGroupId, PEContext.Current.User.GroupId.ToString()))
                {
                    this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_PurviewCheckedErr2;
                    flag          = false;
                }
                return(flag);
            }
            return(flag);
        }
Esempio n. 7
0
        private static void CheckTreePermission(StringBuilder xmlBuilder, NodeInfo nodeInfo, ref string arrModelName, ref string icon, ref string action)
        {
            bool   flag     = UserPermissions.AccessCheck(OperateCode.NodeContentInput, nodeInfo.NodeId);
            string checkStr = UserPermissions.GetRoleNodeId(PEContext.Current.User.RoleId, OperateCode.NodeContentInput, PEContext.Current.User.UserInfo.IsInheritGroupRole ? 1 : 0);
            string findStr  = nodeInfo.NodeId.ToString();
            bool   flag2    = false;

            if ((nodeInfo.ArrChildId.IndexOf(",", StringComparison.Ordinal) > 0) && !flag)
            {
                if (!string.IsNullOrEmpty(nodeInfo.ArrChildId))
                {
                    findStr = nodeInfo.ArrChildId;
                }
                if (StringHelper.FoundCharInArr(checkStr, findStr))
                {
                    flag2 = true;
                }
            }
            if ((nodeInfo.ParentId > 0) && !flag)
            {
                findStr = nodeInfo.ParentPath + "," + nodeInfo.NodeId.ToString();
                flag    = StringHelper.FoundCharInArr(checkStr, findStr);
            }
            StringBuilder builder = new StringBuilder();

            if (string.IsNullOrEmpty(action))
            {
                action = " ContentManage.aspx";
            }
            object obj2 = action;

            action = string.Concat(new object[] { obj2, "?NodeID=", nodeInfo.NodeId, "&amp;NodeName=", HttpContext.Current.Server.UrlEncode(DataSecurity.XmlEncode(nodeInfo.NodeName)) });
            if (flag || flag2)
            {
                xmlBuilder.Append("<tree ");
                xmlBuilder.Append("text=\"" + DataSecurity.XmlEncode(nodeInfo.NodeName) + "\" ");
                xmlBuilder.Append("arrModelId=\"");
                xmlBuilder.Append(builder.ToString());
                xmlBuilder.Append("\" ");
                xmlBuilder.Append("arrModelName=\"");
                xmlBuilder.Append((string)arrModelName);
                xmlBuilder.Append("\" ");
                xmlBuilder.Append("nodeId=\"");
                xmlBuilder.Append(nodeInfo.NodeId);
                xmlBuilder.Append("\" ");
                xmlBuilder.Append("target=\"\" ");
                xmlBuilder.Append("expand=\"0\" ");
                if (nodeInfo.Child > 0)
                {
                    xmlBuilder.Append("src=\"ContentSelectTreeXml.aspx?Action=Content&amp;NodeID=" + nodeInfo.NodeId + "\" ");
                }
                xmlBuilder.Append("action=\"#\" ");
                if (!flag)
                {
                    icon = "Forbid";
                    xmlBuilder.Append(" anchorType=\"0\" ");
                }
                else
                {
                    switch (nodeInfo.PurviewType)
                    {
                    case 0:
                        icon = "Container";
                        break;

                    case 1:
                        icon = "HalfOpen";
                        break;

                    case 2:
                        icon = "Purview";
                        break;

                    default:
                        icon = "Container";
                        break;
                    }
                    if (!nodeInfo.Settings.EnableAddWhenHasChild && (nodeInfo.Child > 0))
                    {
                        icon = "Forbid";
                        xmlBuilder.Append(" anchorType=\"0\" ");
                    }
                    else
                    {
                        xmlBuilder.Append(" anchorType=\"2\" ");
                    }
                }
                xmlBuilder.Append("icon=\"");
                xmlBuilder.Append((string)icon);
                xmlBuilder.Append("\" ");
                xmlBuilder.Append(" />");
            }
        }