-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
用户权限 401 与 菜单显示隐藏 404 的 BUG #2196
Comments
因为路由是动态挂载的,我也遇到这个问题,现在也不知道怎么解决 |
同问,大佬 翻哈牌啊 |
因为路由是动态挂载的,当 |
修复用户访问权限不足页面,跳转到404,而不是401页面 BREAKING CHANGE: 🧨 修复用户访问权限不足页面,跳转到404,而不是401页面|管理员权限 依赖配置,而不是默认全部 ✅ Closes: 修复此bug PanJiaChen#2196
如上,我的提交,已经修复此bug。改动点如下: `
}` #2. 当前逻辑,动态路由,使用filterAsyncRouter方法,过滤掉当前用户无权限的路由例如/icon/index,用户访问自然会到404页面,因为路由里匹配不到。修改store/modules/permission.js,改为无权限路由隐藏
#3. 增加拦截器,无权限页面,用户从地址栏输入做拦截跳转到401 router.afterEach((to, next) => { ========================= #4. 修改路由文件src/router/index.js,用/icon 路由做测试 如果用是使用editer角色登录,左侧菜单栏是可以看见/icon菜单,地址栏输入,也是可以访问 |
Bug report(问题描述)
当权限不足的用户,进入页面时,无法区分权限不足还是因为路径错误导致的 404
Steps to reproduce(问题复现步骤)
正常处理
更改用户角色后,尝试未授权页面,应提示未授权,进入错误路径时可提示 404
Link to minimal reproduction(最小可在线还原demo)
Other relevant information(格外信息)
The text was updated successfully, but these errors were encountered: