Giter Site home page Giter Site logo

好像没有权限管理模块? about gf HOT 6 CLOSED

gogf avatar gogf commented on May 3, 2024
好像没有权限管理模块?

from gf.

Comments (6)

gqcn avatar gqcn commented on May 3, 2024

@DBSN 很多朋友都问过这个问题,不过目前GF框架暂时没有权限管理模块,可以考虑第三方比较成熟的casbin包。未来GF会有权限管理模块,可能是轻量级的RBAC方式,也可能会基于casbin

from gf.

taixs avatar taixs commented on May 3, 2024

收到,多谢作者回复。

from gf.

hsluoyz avatar hsluoyz commented on May 3, 2024

你好,Casbin目前对大多数Web框架都有插件来支持集成,gf框架的,应该也需要写一个gf-authz插件。但是看了下官方文档,好像没有找到插件开发相关的内容,请问如何开发一个gf的过滤器插件呢?

from gf.

gqcn avatar gqcn commented on May 3, 2024

@hsluoyz 你好,官方文档的确没有权限这块的说明。自行实现权限校验可以通过HOOK回调注册一个全局的HOOK_BEFORE_SERVE回调钩子来实现,如/*, /api/*等等全局的路由。在回调函数中调用相应的校验模块来完成权限校验,如果权限校验失败,调用r.ExitAll()退出后续的业务逻辑执行即可。

from gf.

gqcn avatar gqcn commented on May 3, 2024

@hsluoyz 你好,关于gf的权限管理插件可以参考gf-jwt这个插件来编写:https://github.com/gogf/gf-jwt 不知道你是否有时间为gf贡献一款基于casbin的权限管理插件?

from gf.

vance-liu avatar vance-liu commented on May 3, 2024

可以参考下这个 https://github.com/vance-liu/gdb-adapter

from gf.

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.