casbin: github.com/casbin/casbin/rbac/default-role-manager Index | Files

package defaultrolemanager

import "github.com/casbin/casbin/rbac/default-role-manager"

Index

Package Files

role_manager.go

func NewRoleManager Uses

func NewRoleManager(maxHierarchyLevel int) rbac.RoleManager

NewRoleManager is the constructor for creating an instance of the default RoleManager implementation.

type MatchingFunc Uses

type MatchingFunc func(arg1, arg2 string) bool

type Role Uses

type Role struct {
    // contains filtered or unexported fields
}

Role represents the data structure for a role in RBAC.

type RoleManager Uses

type RoleManager struct {
    // contains filtered or unexported fields
}

RoleManager provides a default implementation for the RoleManager interface

func (*RoleManager) AddDomainMatchingFunc Uses

func (rm *RoleManager) AddDomainMatchingFunc(name string, fn MatchingFunc)

AddDomainMatchingFunc support use domain pattern in g

func (rm *RoleManager) AddLink(name1 string, name2 string, domain ...string) error

AddLink adds the inheritance link between role: name1 and role: name2. aka role: name1 inherits role: name2.

func (*RoleManager) AddMatchingFunc Uses

func (rm *RoleManager) AddMatchingFunc(name string, fn MatchingFunc)

AddMatchingFunc support use pattern in g

func (*RoleManager) Clear Uses

func (rm *RoleManager) Clear() error

Clear clears all stored data and resets the role manager to the initial state.

func (rm *RoleManager) DeleteLink(name1 string, name2 string, domain ...string) error

DeleteLink deletes the inheritance link between role: name1 and role: name2. aka role: name1 does not inherit role: name2 any more.

func (*RoleManager) GetRoles Uses

func (rm *RoleManager) GetRoles(name string, domain ...string) ([]string, error)

GetRoles gets the roles that a subject inherits.

func (*RoleManager) GetUsers Uses

func (rm *RoleManager) GetUsers(name string, domain ...string) ([]string, error)

GetUsers gets the users that inherits a subject. domain is an unreferenced parameter here, may be used in other implementations.

func (rm *RoleManager) HasLink(name1 string, name2 string, domain ...string) (bool, error)

HasLink determines whether role: name1 inherits role: name2.

func (*RoleManager) PrintRoles Uses

func (rm *RoleManager) PrintRoles() error

PrintRoles prints all the roles to log.

type Roles Uses

type Roles struct {
    sync.Map
}

Roles represents all roles in a domain

Package defaultrolemanager imports 5 packages (graph) and is imported by 3 packages. Updated 2020-06-18. Refresh now. Tools for package owners.