/// <summary> /// 功能权限控制 /// </summary> public void funTree() { if (CurrentMaster != null) { string _typeId = Request["TypeID"]; _key = Request["key"]; string output; DataTable mytab; string name = (Request["TreeName"] == null ? "" : Request["TreeName"]); //查询过滤条件 if (CurrentMaster.Attribute != (int)AdminTypeEnum.普通员工) //超级管理员 { string where = ""; if (name != "") { where += " FunName like '%" + name + "%' and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常; } else { where += " TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常; } mytab = new BllSysFun().GetTreeList(where).Tables[0]; //获取所有树 } else { BllSysMaster mybase = new BllSysMaster(); _where += (name == "" ? " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常 : " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常 + " and FunName like '%" + name + "%'"); mytab = mybase.GetAuthByPage(CurrentMaster.RoleIdList, _where).Tables[0]; } GetTreeNode(mytab);//功能权限 } Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); }
/// <summary> /// 菜单树,有权限的菜单 /// </summary> /// <param name="childId"></param> /// <param name="master">登录用户对象</param> public void InitRoleTree(string childId, ModSysMaster master) { string output = ""; string _where = "1=1"; //获取 try { BllSysMaster mybase = new BllSysMaster(); string name = (Request["name"] == null ? "" : Request["name"]); //查询过滤条件 _where += (name == "" ? " and Status=" + (int)StatusEnum.正常 : " and Status=" + (int)StatusEnum.正常 + " and FunName like '%" + name + "%'"); if (!String.IsNullOrEmpty(master.RoleIdList)) { DataSet _mySet = mybase.GetAuthByPage(master.RoleIdList, _where); if (_mySet.Tables.Count > 0) { if (name == "") { output = JsonHelper.ToJson(new FunTreeCommon().GetFunTreeNodes(_mySet)); } else { output = JsonHelper.ToJson(new FunTreeCommon().GetSearchTreeNodes(_mySet)); } } else { var msg = new ModJsonResult(); msg.success = false; msg.msg = "您暂未有访问权限"; output = JsonHelper.ToJson(msg); } } else { var msg = new ModJsonResult(); msg.success = false; msg.msg = "您暂未有访问权限"; output = JsonHelper.ToJson(msg); } } catch { var msg = new ModJsonResult(); msg.success = false; output = JsonHelper.ToJson(msg); } Response.Write(output); Response.End(); }
/// <summary> /// 范围权限控制 /// </summary> public void roleTree() { if (CurrentMaster != null) { string _typeId = Request["TypeID"]; _key = Request["key"]; string output; DataTable mytab; BllSysMaster mybase = new BllSysMaster(); _where += " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常; DataSet ds = mybase.GetAuthByPage("'" + _key + "'", _where); if (ds.Tables.Count > 0) { mytab = ds.Tables[0]; GetRoleTreeNode(mytab); } else { WriteJsonToPage(Output); return; } } Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); }
/// <summary> /// 查看他人权限设置 /// </summary> public void GetOtherfunTree() { if (CurrentMaster != null) { string _typeId = Request["TypeID"]; _key = Request["key"]; string output; DataTable mytab = null; BllSysMaster mybase = new BllSysMaster(); //查询角色创建人 BllSysRole role = new BllSysRole(); var roleInfo = role.LoadData(_key); var other = mybase.LoadData(roleInfo.CreaterId); //角色用户 if (other.Attribute != (int)AdminTypeEnum.普通员工) //超级管理员,不用控权 { _where += " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常; mytab = new BllSysFun().GetTreeList(_where).Tables[0]; //获取所有树 } else { string roleIdList = new BllSysMasterRole().GetMasterRole(other.Id); if (!String.IsNullOrEmpty(roleIdList)) { _where += " and TypeID=" + _typeId + "and Status=" + (int)StatusEnum.正常; mytab = mybase.GetAuthByPage(roleIdList, _where).Tables[0]; } else { WriteJsonToPage(Output); return; } } GetTreeNode(mytab);//功能权限 } Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); }