Categorygithub.com/gromitlee/access
repositorypackage
1.1.0
Repository: https://github.com/gromitlee/access.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

access

Go Role Based Access Control (RBAC0)

  • 设计实现符合RBAC定义
  • 支持完全由用户自定义的角色(Role)、权限(Perm);其中权限由资源(Obj)和操作(Act)组成
  • 同一套API提供两种实现方式:access自身对RBAC的实现与封装casbin的实现
  • 提供两种使用方式:全局单例方式与管理器方式
  • 提供基于gorm的数据存储
  • Goroutine Safe & Developer Friendly

安装

go get github.com/gromitlee/access

引入

import "github.com/gromitlee/access"

使用方式1:全局单例

API详见rbac0_api.go

access实现

示例详见examples/access_rbac0_test.go

access.InitAccessRBAC0Controller(db)

casbin实现

示例详见examples/casbin_rbac0_test.go

access.InitCasbinRBAC0Controller(db, modelFilePath)

使用方式2:管理器

API详见rbac0_controller.go

access实现

示例同上

ctl, err := access.NewAccessRBAC0Controller(db)

casbin实现

示例同上

ctl, err := access.NewCasbinRBAC0Controller(db, modelFilePath)