关于权限相关讨论 #309
Replies: 15 comments 5 replies
-
👋 @timi137137,感谢给 TDesign 提出了 issue。 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
4吧,多点选择,毕竟需求不是统一的 |
Beta Was this translation helpful? Give feedback.
-
3 权限数据理应由后台提供, 前端负责交互和渲染 |
Beta Was this translation helpful? Give feedback.
-
3 看过好几个开源项目都是由后台提供权限数据, 前端负责交互和渲染 |
Beta Was this translation helpful? Give feedback.
-
3 权限数据理应由后台提供, 前端负责交互和渲染 |
Beta Was this translation helpful? Give feedback.
-
3 权限数据理应由后台提供, 前端负责交互和渲染 |
Beta Was this translation helpful? Give feedback.
-
统计结束,更多人选3,这几天会pr更新 |
Beta Was this translation helpful? Give feedback.
-
前端后端统一一个格式,后端新增前端就会自动新增 |
Beta Was this translation helpful? Give feedback.
-
支持3,已上生产!对后端开发友好,现在都在降本增效,搞全栈,卷起来! |
Beta Was this translation helpful? Give feedback.
-
好像还没有权限控制? |
Beta Was this translation helpful? Give feedback.
-
怎么跟据接口返回的权限数据来控制要显示的菜单? |
Beta Was this translation helpful? Give feedback.
-
目前已在0.7版本新增“通过后台来动态生成路由表(后端方式控制” |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
目前市面上有这么几种较为通用的权限方式,希望各位能投票选出你所认为最好的权限方式,或提出更好的意见。
前端角色权限
实现原理: 在前端固定写死路由的权限,指定路由有哪些权限可以查看。只初始化通用的路由,需要权限才能访问的路由没有被加入路由表内。在登陆后或者其他方式获取用户角色后,通过角色去遍历路由表,获取该角色可以访问的路由表,生成路由表,再通过 添加到路由实例,实现权限的过滤。
缺点: 权限相对不自由,如果后台改动角色,前台也需要跟着改动。适合角色较固定的系统
1. 通过用户角色来过滤菜单(前端方式控制),菜单和路由分开配置
2. 通过用户角色来过滤菜单(前端方式控制),菜单由路由配置自动生成
后端角色权限
实现原理: 是通过接口动态生成路由表,且遵循一定的数据结构返回。前端根据需要处理该数据为可识别的结构,再通过添加到路由实例,实现权限的动态生成。
3. 通过后台来动态生成路由表(后端方式控制)
4. 三种方式集成到项目中由用户自行选择
Beta Was this translation helpful? Give feedback.
All reactions