Git Product home page Git Product logo

Comments (7)

maoxiaoquan avatar maoxiaoquan commented on May 28, 2024

你可以看前台的用户是一个用户多角色的

from kite.

maoxiaoquan avatar maoxiaoquan commented on May 28, 2024

不过我判断权限的时候取巧了一下,其实我自己也是学习的,每次请求的原因是,有的时候实时更新了权限,能实时刷新,可以存,每次登陆的时候根据直接获取用户角色权限可以和登录态存一起,但是如果更新角色权限了就没法实时刷新权限,所以我就没有存

from kite.

maoxiaoquan avatar maoxiaoquan commented on May 28, 2024

角色的权限Id是通过逗号分隔的,多角色,直接遍历一下,去除相同的,连接到一个字符串,indexOf判断有没有就可以,我为了省事,就没有去重,没多大的关系

from kite.

maoxiaoquan avatar maoxiaoquan commented on May 28, 2024

这个系统,
前台是一个用户多角色,判断权限是,取多角色权限遍历后,权限ID逗号分隔连接在一起,通过indexOf判断,(这个应该能理解我的意思吧,这是我自己想的方法,我不知道别人是咋弄的)
后台就是一个管理员单角色

from kite.

maoxiaoquan avatar maoxiaoquan commented on May 28, 2024

第二种方法还可以通过:
用户A有两个角色 -----> B和C 的角色ID为 1 和 2
然后需要判断权限的为登录权限 /login 权限ID为 3
直接去查询表,角色 ID为 1或者 2,权限ID为3,有没有这一条数据在,
有就说明有权限,没有就是没有权限,

from kite.

maoxiaoquan avatar maoxiaoquan commented on May 28, 2024

方法有很多,每个人想的都不一样

from kite.

afacode avatar afacode commented on May 28, 2024

感谢

from kite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.