public BaseResponse GetNavigationBar(int uid) { if (uid > 0) { var roleId = _userRoleServices.Get(d => d.IsDeleted == false && d.UserId == uid)?.RoleId; if (roleId > 0) { var pids = _roleModulePermissionServices.Query(d => d.IsDeleted == false && d.RoleId == roleId).Select(d => d.PermissionId).Distinct(); if (pids.Any()) { var rolePermissionMoudles = _permissionServices.Query(d => pids.Contains(d.Id) && d.IsButton == false).OrderBy(c => c.OrderSort); var permissionTrees = (from child in rolePermissionMoudles where child.IsDeleted == false orderby child.Id select new NavigationBar { id = child.Id, name = child.Name, pid = (int)child.Pid, order = child.OrderSort, path = child.Code, iconCls = child.Icon, key = child.Key, component = child.Component, isbutton = child.IsButton, meta = new NavigationBarMeta { requireAuth = true, title = child.Name, icon = child.Icon } }).ToList(); NavigationBar rootRoot = new NavigationBar() { id = 0, pid = 0, order = 0, name = "根节点", path = "", iconCls = "", component = "BasicLayout", key = "", meta = new NavigationBarMeta(), }; permissionTrees = permissionTrees.OrderBy(d => d.order).ToList(); RecursionHelper.LoopNaviBarAppendChildren(permissionTrees, rootRoot); List <NavigationBar> list = new List <NavigationBar>(); list.Add(rootRoot); return(new SuccessResponse(list)); } } } return(new SuccessResponse()); }
private IEnumerable <UserRoleEntity> GetUserRoles(int userId) { return(UserRoleServices.Get(WebConfigHelper.ApplicationIdCed, userId)); }