casbinauth

package
v0.0.0-...-179e57f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

* @Description:casbin方法二次封装 * @Author: gphper * @Date: 2021-07-20 20:52:20

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGroup

func AddGroup(ptype string, sub string, group string) (bool, error)

将用户添加至指定分组

func AddGroups

func AddGroups(ptype string, rules [][]string, txs ...*gorm.DB) (bool, error)

批量添加用户权限

func AddPolice

func AddPolice(rules [][]string) (bool, error)

添加规则

func Check

func Check(sub string, obj string, act string) (bool, error)

验证权限

func DelGroups

func DelGroups(ptype string, rules [][]string) (ok bool, err error)

删除权限

func GetEnforceObj

func GetEnforceObj() *casbin.Enforcer

func GetGroupByUser

func GetGroupByUser(username string) ([]string, error)

通过用户获取所在组

func GetGroups

func GetGroups() []string

获取全部分组

func GetPoliceByGroup

func GetPoliceByGroup(group string) [][]string

根据用户组获取权限

func GetRols

func GetRols() []string

func HasObjByGroup

func HasObjByGroup(groupname string, obj string, act string) bool

获取组中是否具有该权限

func PutEnforceObj

func PutEnforceObj(en *casbin.Enforcer)

func RemovePolices

func RemovePolices(rules [][]string) (bool, error)

删除规则

func UpdateGroups

func UpdateGroups(username string, old []string, new []string, tx *gorm.DB) (ok bool, err error)

更新用户所属用户组

func UpdatePolices

func UpdatePolices(groupname string, old []string, new []string, tx *gorm.DB) (ok bool, err error)

更新指定用户组的权限

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL