public ActionResult GetRightTree(string belong, long pId = 0, bool last = true, string chk = "") { //权限检查 Helper.IsCheck(HttpContext, belong + "Right", SystemRight.Browse.ToString(), true); Result <List <Base_Right> > result = new Result <List <Base_Right> >(); RoleType roleType = belong.ToEnumReq <RoleType>(); using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request))) { result = proxy.LoadRightList(roleType); } Base_Right right = null; var list = result.Data; var be = belong.ToEnumReq <RoleType>(); switch (be) { case RoleType.Admin: list.Insert(0, Helper.AdminSite); break; //case RoleType.Tenderer: // break; //case RoleType.BiddingAgent: // list.Insert(0, Helper.BiddingAgentSite); // break; //case RoleType.Bidder: // break; //case RoleType.Exp: // break; default: right = Helper.WebSite; right.Belong = roleType.ToString(); list.Insert(0, right); break; } var first = list.FirstOrDefault(i => i.Id == pId); RightNode rootTree = new RightNode(); rootTree.checkboxValue = first.Id.ToString(); rootTree.@checked = chk == first.Id.ToString(); rootTree.data = new { code = first.Code, id = first.Id.ToString() }; rootTree.name = first.Name; rootTree.spread = true; var tree = createTree(first.Id, list); if (!last) { tree = createTreeNoLast(first.Id, list, chk); } rootTree.children = tree; return(Json(rootTree, JsonRequestBehavior.AllowGet));; }
public ActionResult GetRightTree(string belong, long roleId) { if (belong != "Admin") { belong = "Owner"; } Result <List <Base_Right> > result = new Result <List <Base_Right> >(); RoleType roleType = belong.ToEnumReq <RoleType>(); Result <List <Base_RoleRight> > roleRight = new Result <List <Base_RoleRight> >(); List <long> roleRightIds = new List <long>(); using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request))) { result = proxy.LoadRightList(roleType); //获取角色的所有权限 roleRight = proxy.GetRightByRoleIds(new List <long>() { roleId }); if (roleRight.Data != null && roleRight.Data.Any()) { roleRightIds = roleRight.Data.Select(i => i.RightId).ToList(); } } Base_Right right = null; var list = result.Data; switch (roleType) { case RoleType.Admin: //管理员 list.Insert(0, Helper.AdminSite); break; default: //业务应用站点,包括(业主,监理,施工,咨询,设计) right = Helper.WebSite; right.Belong = roleType.ToString(); list.Insert(0, right); break; } var first = list.FirstOrDefault(i => i.Id == 0); RightNode rootTree = new RightNode(); rootTree.checkboxValue = first.Id.ToString(); rootTree.@checked = roleRightIds.Count() > 0; rootTree.data = new { code = first.Code, id = first.Id.ToString() }; rootTree.name = first.Name; rootTree.spread = true; var tree = createTree(first.Id, list, roleRightIds); rootTree.children = tree; return(Json(rootTree, JsonRequestBehavior.AllowGet));; }
public ActionResult Add(Base_Right model) { ResultView <string> view = new ResultView <string>(); if (string.IsNullOrEmpty(model.Name)) { view.Flag = false; view.Message = "名称不能为空"; return(Json(view)); } Result <int> result = new Result <int>(); using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request))) { result = proxy.AddRight(model); } return(Json(result.ToResultView())); }
public ActionResult Add(Base_Right model) { ResultView <string> view = new ResultView <string>(); if (string.IsNullOrEmpty(model.Name)) { view.Flag = false; view.Message = "名称不能为空"; return(Json(view)); } //权限检查 Helper.IsCheck(HttpContext, model.Belong + "Right", SystemRight.Add.ToString(), true); Result <int> result = new Result <int>(); using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request))) { result = proxy.AddRight(model); } return(Json(result.ToResultView())); }
public ActionResult Edit(Base_Right model) { Result <int> result = new Result <int>(); using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request))) { var oldModel = proxy.GetRightModel(model.Id).Data; //只允许修改以下项 oldModel.Sort = model.Sort; oldModel.Tips = model.Tips; oldModel.IsMenu = model.IsMenu; oldModel.URL = model.URL; oldModel.CssClass = model.CssClass; oldModel.Icon = model.Icon; oldModel.Remark = model.Remark; oldModel.Target = model.Target; oldModel.DisplayName = model.DisplayName; result = proxy.UpdateRight(oldModel); } return(Json(result.ToResultView())); }
public ActionResult Edit(Base_Right model) { Helper.IsCheck(HttpContext, model.Belong + "Right", SystemRight.Modify.ToString(), true); Result <int> result = new Result <int>(); using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request))) { var oldModel = proxy.GetRightModel(model.Id).Data; //只允许修改以下项 oldModel.Sort = model.Sort; oldModel.Tips = model.Tips; oldModel.IsMenu = model.IsMenu; oldModel.URL = model.URL; oldModel.CssClass = model.CssClass; oldModel.Icon = model.Icon; oldModel.Remark = model.Remark; oldModel.Target = model.Target; oldModel.DisplayName = model.DisplayName; oldModel.ShortName = model.ShortName; result = proxy.UpdateRight(oldModel); } return(Json(result.ToResultView())); }
/// <summary> /// 修改权限 /// </summary> /// <param name="model"></param> /// <returns></returns> public Result <int> UpdateRight(Base_Right model) { return(base.Channel.UpdateRight(model)); }
/// <summary> /// 添加权限 /// </summary> /// <param name="model"></param> /// <returns></returns> public Result <int> AddRight(Base_Right model) { return(base.Channel.AddRight(model)); }