spring-boot-plus V1.4.0发布 集成用户角色权限部门管理

发布时间:2020-07-07 03:21:50 作者:geekidea
来源:网络 阅读:3118

RBAC用户角色权限

用户角色权限部门管理核心接口介绍

Shiro权限配置

数据库模型图

spring-boot-plus V1.4.0发布 集成用户角色权限部门管理

获取验证码

验证码演示
spring-boot-plus:
  # 是否启用ansi控制台输出有颜色的字体
  enable-ansi: true
  # 是否启用验证码
  enable-verify-code: true

enable-verify-code 设置为 true 启用验证码验证

两种方式获取验证码

验证码后台保存在Redis中,过期时间默认为5分钟

spring-boot-plus V1.4.0发布 集成用户角色权限部门管理

方式一:

输出图片流到浏览器,验证码token输出到响应头

http://localhost:8888/verificationCode/getImage

spring-boot-plus V1.4.0发布 集成用户角色权限部门管理

Response Headers
HTTP/1.1 200
verifyToken: 6515b4b798ce49e68b1e40f98ff8eb19
方式二:

获取Base64编码图片和验证码token

http://localhost:8888/verificationCode/getBase64Image
{
  "code": 200,
  "msg": "操作成功",
  "success": true,
  "data": {
    "image": "data:image/png;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAmAG4DASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh5iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09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4mlWNlADR/vGP1xj6fgKme+plim/bST1LNzoWmyTNO9lbF5HBYm3jJJJ5OSvXJzVJvDulC7jhezg2kYBWFB6kZ+X0Vs/h+BRWalLucd2aEtkbc+akjGNEO7kBhj04+vp9ea4bUvErPb3lg0G9vMdFlZhwM+mMg4HZutFFcGPqzp004u1wk3y3NbTrN7Pw/bl5MuyLIoX7uHywzx1wDx+tSq/mAgADOAcgdevp7UUV30FahH0X5I1T90kV4nUIAzcZJYAYPtioI9J021m+2Cwtmn3M5k8oK5z1+YeuTzj+dFFaqTWzM572LJVG80l5VY84yH3fU8dx/nFNUvChZZSrj7u1R+PPUdP85oopN2dhqTuQMElEwnJIkVlYY3B8jkMD1BBOetYUPgrw2siMumLvVsjMrspxzyCxBFFFXfRm7nKmnyNo3lAtQqW6LDGgGxI+AmOw9qlgnKE7WkRj/EjY/z2ooqVsczk7XP/9k=",
    "verifyToken": "42ba8abde7bc47b2b1397b4d6676956a"
  },
  "time": "2019-11-01 22:40:37"
}

系统用户登陆

spring-boot-plus V1.4.0发布 集成用户角色权限部门管理

登陆成功

{
  "code": 200,
  "msg": "登陆成功",
  "success": true,
  "data": {
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJ3ZWIiLCJpc3MiOiJzcHJpbmctYm9vdC1wbHVzIiwiZXhwIjoxNTcyNjIzMDE5LCJpYXQiOjE1NzI2MTk0MTksImp0aSI6IjdlZmVlM2UwMjc2MTRiYTc5M2I2YmYwZmE4NTgzYmUwIiwidXNlcm5hbWUiOiJhZG1pbiJ9.O3w7CNRqw_Miwp8MDzPND6w490c9Q7yFlKpFJK9ubSU",
    "loginSysUserVo": {
      "id": "1",
      "username": "admin",
      "nickname": "管理员",
      "gender": 1,
      "state": 1,
      "departmentId": "1",
      "departmentName": "管理部",
      "roleId": "1",
      "roleName": "管理员",
      "roleCode": "admin",
      "permissionCodes": [
        "sys:permission:codes",
        "system:management",
        "sys:department:update",
        "sys:department:page",
        "sys:role:management",
        "sys:permission:add",
        "sys:user:add",
        "sys:role:page",
        "sys:permission:page",
        "sys:department:delete",
        "sys:permission:management",
        "sys:user:delete",
        "sys:department:management",
        "sys:user:page",
        "sys:user:update",
        "sys:user:update:password",
        "sys:user:update:head",
        "sys:role:add",
        "sys:permission:menu:tree",
        "sys:department:info",
        "sys:permission:all:menu:list",
        "sys:permission:info",
        "sys:role:info",
        "sys:permission:all:menu:tree",
        "sys:permission:update",
        "sys:permission:menu:list",
        "sys:role:update",
        "sys:user:info",
        "sys:user:management",
        "sys:role:delete",
        "sys:permission:delete"
      ]
    }
  },
  "time": "2019-11-01 22:43:39"
}

部门树形列表

spring-boot-plus V1.4.0发布 集成用户角色权限部门管理

角色管理

spring-boot-plus V1.4.0发布 集成用户角色权限部门管理

设置角色权限

权限管理

spring-boot-plus V1.4.0发布 集成用户角色权限部门管理

权限树形列表

权限编码列表

返回当前用户所有的权限编码,方便前端展示导航菜单和功能按钮

http://127.0.0.1:8888/sysPermission/getPermissionCodesByUserId/1
{
  "code": 200,
  "msg": "操作成功",
  "success": true,
  "data": [
    "system:management",
    "system:management",
    "sys:user:management",
    "sys:user:management",
    "sys:role:management",
    "sys:permission:management",
    "sys:department:management",
    "sys:user:add",
    "sys:user:add",
    "sys:user:update",
    "sys:user:update",
    "sys:user:delete",
    "sys:user:delete",
    "sys:user:info",
    "sys:user:info",
    "sys:user:page",
    "sys:user:page",
    "sys:user:update:password",
    "sys:user:update:head",
    "sys:role:add",
    "sys:role:update",
    "sys:role:delete",
    "sys:role:info",
    "sys:role:page",
    "sys:permission:add",
    "sys:permission:update",
    "sys:permission:delete",
    "sys:permission:info",
    "sys:permission:page",
    "sys:permission:all:menu:list",
    "sys:permission:all:menu:tree",
    "sys:permission:menu:list",
    "sys:permission:menu:tree",
    "sys:permission:codes",
    "sys:department:update",
    "sys:department:delete",
    "sys:department:info",
    "sys:department:page"
  ],
  "time": "2019-11-02 00:32:17"
}

注意

GITHUB:https://github.com/geekidea/spring-boot-plus

推荐阅读:
  1. Mybatis3+Spring4+SpringMVC4 整合【转】
  2. springmvc+spring+mybatis+maven项目集成shiro进行用户权限控制【转】

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

springboot springboot.plus 用户角色权限

上一篇:安卓应用-自定义监听器2

下一篇:RMAN-06820: WARNING: failed to archive current log at primary database

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》