admin/fix_403_permission.sql
lvfengfree b92e1119ae fix: 修复菜单为空问题 - 移除后端过滤home路由的错误逻辑
- 修复RouteService中错误过滤home路由的问题
- 后端现在正确返回所有用户有权限的路由
- 添加设备管理相关功能(列表、在线监控、电源管理、远程监控)
- 添加详细的修复文档和重启脚本
- 更新权限配置脚本

问题根源:后端代码中有逻辑会过滤掉home路由,导致前端收到空数组,无法生成菜单
解决方案:移除过滤home路由的逻辑,让后端返回所有有权限的路由
2026-03-01 09:50:19 +08:00

47 lines
2.0 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 诊断和修复403权限问题
USE soybean_admin;
-- 1. 检查当前用户和角色配置
SELECT '=== 当前用户配置 ===' AS info;
SELECT user_id, user_name, roles, status FROM sys_user;
SELECT '=== 当前角色配置 ===' AS info;
SELECT role_code, role_name, menus, status FROM sys_role;
-- 2. 检查路由表中的路由名称
SELECT '=== 路由表中的路由 ===' AS info;
SELECT name, path, component, status FROM sys_route WHERE status = 1 ORDER BY order_num;
-- 3. 修复:确保角色表存在且有正确的菜单配置
-- 如果角色的menus字段为空或NULL更新它们
-- 为超级管理员配置所有菜单包括home和device相关
UPDATE sys_role
SET menus = 'home,device,device_list,device_online,device_power,device_monitor,device_group,screen,screen_wall,screen_control,screen_record,user-manage,user-manage_list,user-manage_role,user-manage_permission,application,application_approval,application_history,system,system_amt,system_agent,system_log'
WHERE role_code = 'R_SUPER';
-- 为管理员配置大部分菜单(除了系统设置和权限管理)
UPDATE sys_role
SET menus = 'home,device,device_list,device_online,device_power,device_monitor,device_group,screen,screen_wall,screen_control,screen_record,user-manage,user-manage_list,user-manage_role,application,application_approval,application_history'
WHERE role_code = 'R_ADMIN';
-- 为普通用户配置基本菜单
UPDATE sys_role
SET menus = 'home,my-device,my-device_status,my-device_power-control,my-device_remote-control,my-application,my-application_apply,my-application_my-list'
WHERE role_code = 'R_USER';
-- 4. 验证修复结果
SELECT '=== 修复后的角色配置 ===' AS info;
SELECT role_code, role_name, menus, status FROM sys_role;
-- 5. 检查路由名称是否匹配
SELECT '=== 检查路由名称匹配情况 ===' AS info;
SELECT
r.role_code,
r.menus AS configured_menus,
GROUP_CONCAT(rt.name ORDER BY rt.name) AS available_routes
FROM sys_role r
CROSS JOIN sys_route rt
WHERE rt.status = 1
GROUP BY r.role_code, r.menus;