casbin_agent

package
v0.0.0-...-adbf6dd Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ExtendedRBACWithDomainModelString = `` /* 356-byte string literal not displayed */

RBAC with domain model for Casbin, supports evaluation of extra information

  • sub: user / role
  • ext: extra information
  • ext_rule: expression to evaluate extra information
  • dom: domain
  • obj: object, supports gin router key match (EX: /api/v1/user/:id/*any)
  • act: action, supports regex match (EX: GET | POST)
  • eft: effect

Router key match will not work if keyMatchGin is not defined in the model.

You should also prepare an extra information struct to evaluate the extra information and make sure the policy ext_rule is using the correct field (which is included in the extra information struct).

View Source
const RoleSubjectPrefix = "role:"
View Source
const UserSubjectPrefix = "user:"

Variables

This section is empty.

Functions

func GetDefaultCasbinEnforcer

func GetDefaultCasbinEnforcer() *casbin.SyncedCachedEnforcer

func KeyMatchGin

func KeyMatchGin(key1 string, key2 string) bool

KeyMatchGin determines whether key1 matches the pattern of key2 (similar to KeyMatch2 in Casbin). Providing a Gin-like path matching pattern.

Types

type DomainRole

type DomainRole struct {
	Role   string
	Domain string
}

type ExtraInfo

type ExtraInfo struct {
	IsVIP bool
}

Jump to

Keyboard shortcuts

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