-
Notifications
You must be signed in to change notification settings - Fork 114
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
后台用户角色问题 #5
Comments
你可以看前台的用户是一个用户多角色的 |
不过我判断权限的时候取巧了一下,其实我自己也是学习的,每次请求的原因是,有的时候实时更新了权限,能实时刷新,可以存,每次登陆的时候根据直接获取用户角色权限可以和登录态存一起,但是如果更新角色权限了就没法实时刷新权限,所以我就没有存 |
角色的权限Id是通过逗号分隔的,多角色,直接遍历一下,去除相同的,连接到一个字符串,indexOf判断有没有就可以,我为了省事,就没有去重,没多大的关系 |
这个系统, |
第二种方法还可以通过: |
方法有很多,每个人想的都不一样 |
感谢 |
我现在在学后台权限这块功能。
现在后台是一个用户只能对一个角色吗,如果多个角色怎么做高效,还有每次验证权限都得请求数据库,可以一次请求存下来吗,如果能,怎么存,可以下次更新代码的时候添加一下吗,感谢
The text was updated successfully, but these errors were encountered: