Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthChecker ¶
AuthChecker 授权检查接口
func NewAuthChecker ¶
func NewAuthChecker(enforcer *casbin.Enforcer) AuthChecker
NewAuthChecker 创建 AuthChecker 实例
type CasbinManager ¶
type CasbinManager interface {
// 角色 CRUD
AddRolePolicy(role string, api *model.Api) (bool, error)
GetRolePolicies(role string) ([]*model.Api, error)
UpdateRolePolicy(role string, oldApi *model.Api, newApi *model.Api) (bool, error) // 修正:更新时只需要role, 不需要oldRole
DeleteRolePolicy(role string, api *model.Api) (bool, error)
DeleteAllRolePolicies(role string) (bool, error)
// 角色用户 CRUD
AddUserToRole(user, role string) (bool, error)
DeleteUserFromRole(user, role string) (bool, error)
GetUsersInRole(role string) ([]string, error)
GetRolesForUser(user string) ([]string, error)
DeleteUserAllRoles(user string) (bool, error)
LoadPolicy() error
}
CasbinManager 策略和角色管理接口
func NewCasbinManager ¶
func NewCasbinManager(enforcer *casbin.Enforcer) CasbinManager
NewCasbinManager 创建 CasbinManager 实例
Click to show internal directories.
Click to hide internal directories.