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

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

42 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 role_code, role_name, menus FROM sys_role;
-- 2. 修复所有角色的菜单配置
-- 注意:父路由使用连字符(如 user-manage, my-device子路由使用下划线如 user-manage_list, my-device_status
-- 超级管理员:拥有所有权限
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,my-device,my-device_status,my-device_remote-control,my-device_power-control,my-application,my-application_apply,my-application_my-list'
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_remote-control,my-device_power-control,my-application,my-application_apply,my-application_my-list'
WHERE role_code = 'R_USER';
-- 学生:只能访问首页(如果需要更多权限可以添加)
UPDATE sys_role
SET menus = 'home'
WHERE role_code = 'R_STU';
-- 3. 显示修复后的配置
SELECT '=== 修复后的角色配置 ===' AS info;
SELECT role_code, role_name, menus FROM sys_role;
-- 4. 验证路由表中的路由名称
SELECT '=== 数据库中的路由名称 ===' AS info;
SELECT name, path, component FROM sys_route WHERE status = 1 ORDER BY order_num;
-- 5. 检查用户的角色配置
SELECT '=== 用户角色配置 ===' AS info;
SELECT user_id, user_name, roles, status FROM sys_user;