Comments (1)
报错原因:
- 提示的
执行方法[page]需要[hasPermit('station123:view')]权限
是由于后端UriSecurityPreAuthAspect类检测到page方法需要station123:view
权限, 而当前用户没有该权限. - 没有显示新增、修改等按钮是由于前端自定义指令v-has-permission 检测到当前用户没有
station123:add
等权限.
解决方案:
-
前往 “菜单管理” 页面, 选择对应的菜单, 然后在该菜单下配置资源权限.
ps: 为了演示我把StationController类的注解改成了@PreAuth(replace = "station123:")
, 所以提示没有station123:view 权限. 上图中,我这里配置的都是 station:* 权限, 所以会提示没有权限 -
点击上图的新增,编码输入
station123:view
, 名称输入查询. -
前往“角色管理”, 将新建的权限编码
station123:view
分配给超管. -
切换回 “岗位管理” 刷新页面, 可能访问后端数据
-
但此时页面上还是没有 新增、修改等按钮, 是因为前端将用户等权限缓存到了LocalStorage,所以需要用户退出后,重新登录.
后端URI权限原理
通过 @PreAuth
注解拦截Controller 类方法, 判断当前请求头token中封装的用户,是否拥有权限.
代码参考:
- UriSecurityPreAuthAspect //拦截PreAuth注解,并解析注解上标记的资源编码
- VerifyAuthFunction //远程调用接口,获取当前用户的权限, 并判断返回是否拥有指定权限
- OauthUserController#getById // 被调用方, 执行具体的查询逻辑, 查询指定用户拥有的全部权限等数据
前端按钮权限原理
通过按钮上加自定义指令v-has-permission
、v-has-any-permission
、 v-has-no-permission
控制按钮的权限.
代码参考:
- permissionDirect.js
from lamp-cloud.
Related Issues (20)
- 后端启动的时候正常,前端刷新页面报系统繁忙,后台报Cause: java.sql.SQLSyntaxErrorException: Unknown column 'size' in 'field list' HOT 4
- 文档无法查看,报错! HOT 1
- Entity与SuperEntity未加注解@EqualsAndHashCode(callSuper = true)导致子类继承后即便加上该注解hashCode也不一致,调用.equals将返回false HOT 2
- 跨服务回显org时如果在redis中无相应key value将直接往redis插入key,null键值对,导致回显错误 HOT 4
- schema 模式下的多租户. seata 分布式事务问题. 回滚如何找到schema的. HOT 1
- searchFormSchema内定义一个solt 如何在BasicTable展示 ? HOT 2
- BasicTable columns内容多 表头和内容没有对齐 HOT 5
- 验证码接口404 HOT 8
- lamp-web前端代码无法安装依赖 HOT 2
- lamp-cloud如何同时插入三张表的数据 HOT 1
- 删除租户报错 HOT 1
- 企业版lamp-web-pro 4.13.0启动后访问报错 HOT 1
- lamp-boot-pro-datasource-column版本 登录日志和操作日志没有起作用 HOT 2
- ApiSelect HOT 6
- 无效的基本身份验证令牌 HOT 11
- 租户维护:租户已经过了有效期,租户管理员还可以继续登录。 HOT 2
- 邮箱问题 HOT 1
- 创建缓存key时失败 HOT 6
- 将本地的nacos 切换到远程服务器 启动报错 HOT 5
- 项目中切换了数据源 如何在xxl-job中切换数据源 现在是否支持 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 lamp-cloud.