Beispiel #1
0
        /// <summary>
        /// 根据角色Id获取功能列表
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public IList <FunctionModel> GetFunctionListByRoleId(int roleId)
        {
            var funcs          = _funcDal.GetAllPermissions();
            var rolePermission = _funcDal.GetPermissionsByRole(roleId);

            return(funcs.Select(p => new FunctionModel
            {
                Id = p.Id,
                FunctionLevel = p.Level,
                FunctionName = p.PermissionName,
                FunctionSort = p.Sort,
                IconName = p.IconName,
                ParentID = p.ParentId,
                PathUrl = p.PermissionUrl,
                HasRole = rolePermission.Any(rp => rp.PermissionId == p.Id)
            }).ToList());
        }