casbin

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access = ModelRBAC

func NewAccess

func NewAccess(policies Policies) (res *Access)

func (*Access) DisableUser

func (a *Access) DisableUser(ID string)

func (*Access) EnableUser

func (a *Access) EnableUser(ID string, forRoleListID []string)

type IAccess

type IAccess interface {
	EnableUser(ID string, forRoleListID []string)
	DisableUser(ID string)
}

type Model

type Model interface {
	// contains filtered or unexported methods
}

type ModelRBAC

type ModelRBAC struct {
	*casbin.Enforcer
}

func NewRBAC

func NewRBAC(policies Policies) *ModelRBAC

func (*ModelRBAC) AddRolesForUser

func (m *ModelRBAC) AddRolesForUser(id string, lstRoleID []string)

func (*ModelRBAC) CheckPermission

func (m *ModelRBAC) CheckPermission(userID, url, method string) (bool, error)

func (*ModelRBAC) DeleteRoles

func (m *ModelRBAC) DeleteRoles(lst []string)

func (*ModelRBAC) SetPermissionByRole

func (m *ModelRBAC) SetPermissionByRole(id string)

type Policies

type Policies []Policy

func (Policies) Batch

func (lst Policies) Batch(load loader)

type Policy

type Policy struct {
	Subject string
	Object  string
	Action  string
}

Jump to

Keyboard shortcuts

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