Comments (7)
你可以看前台的用户是一个用户多角色的
from kite.
不过我判断权限的时候取巧了一下,其实我自己也是学习的,每次请求的原因是,有的时候实时更新了权限,能实时刷新,可以存,每次登陆的时候根据直接获取用户角色权限可以和登录态存一起,但是如果更新角色权限了就没法实时刷新权限,所以我就没有存
from kite.
角色的权限Id是通过逗号分隔的,多角色,直接遍历一下,去除相同的,连接到一个字符串,indexOf判断有没有就可以,我为了省事,就没有去重,没多大的关系
from kite.
这个系统,
前台是一个用户多角色,判断权限是,取多角色权限遍历后,权限ID逗号分隔连接在一起,通过indexOf判断,(这个应该能理解我的意思吧,这是我自己想的方法,我不知道别人是咋弄的)
后台就是一个管理员单角色
from kite.
第二种方法还可以通过:
用户A有两个角色 -----> B和C 的角色ID为 1 和 2
然后需要判断权限的为登录权限 /login 权限ID为 3
直接去查询表,角色 ID为 1或者 2,权限ID为3,有没有这一条数据在,
有就说明有权限,没有就是没有权限,
from kite.
方法有很多,每个人想的都不一样
from kite.
感谢
from kite.
Related Issues (20)
- 关于本项目
- 设置管理员账号时出错了。 HOT 1
- 本地运行,貌似前台注册,会失败,我数据库8.0,接口/api-client/v1/sign-up HOT 3
- 这个留言是点赞的 HOT 3
- sever端初始化 设置数据库有问题 HOT 1
- 前台访问http://localhost:8081报错了 HOT 3
- 后台管理界面首次进入点击侧边栏收缩按钮样式错乱了 HOT 1
- 后台登录提交没有对用户名和密码做过滤空格的处理 HOT 1
- 运行开发环境接口服务报错,重新安装依赖也没用 HOT 2
- 错误提示:当前功能用户无权限或者当前用户已被网站管理员禁用此功能,请联系管理员开启! HOT 2
- 后端node.js写的服务端代码在哪里? HOT 1
- 你好,我想问一下这个项目后端有没有办法debug HOT 3
- 后台管理页面打开白屏 HOT 3
- 发布文章容易一次性重复发多章 HOT 1
- 请问注册发送验证码时报错550是什么原因 HOT 1
- 一个可能挨打的issue HOT 2
- 初始化第一步
- 0
- 关于小随笔无法注册以及想要联系作者问题。 HOT 1
- 本地不启动后端api,使用代理转发到公共测试环境后端 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kite.