ptree

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitAccountURI

func SplitAccountURI(akuri string) []string

Types

type PermNode

type PermNode struct {
	Name     string         // the name(id) of account/ak/method
	ACL      *pb.Acl        // the ACL definition of this account/method
	Status   ValidateStatus // the ACL validation status of this node
	Children []*PermNode    // the children of this node, usually are ACL members of account/method
}

PermNode defines the node of perm tree

func BuildAccountPermTree

func BuildAccountPermTree(aclMgr base.AclManager, account string, aksuri []string) (*PermNode, error)

BuildAccountPermTree build PermTree for account

func BuildMethodPermTree

func BuildMethodPermTree(aclMgr base.AclManager, contractName string,
	methodName string, aksuri []string) (*PermNode, error)

BuildMethodPermTree build PermTree for contract method

func GetPermTreeList

func GetPermTreeList(root *PermNode) ([]*PermNode, error)

GetPermTreeList return a BFS list of a perm tree

func NewPermNode

func NewPermNode(akName string, acl *pb.Acl) *PermNode

NewPermNode return a default PermNode

func (*PermNode) FindChild

func (pn *PermNode) FindChild(name string) *PermNode

FindChild returns the child node with specified name, nil if not found

type ValidateStatus

type ValidateStatus int

ValidateStatus define the validation status of a perm node

const (

	// NotVerified : not verified by ACLValidator
	NotVerified ValidateStatus
	// Success : ACLValidator verified successful
	Success
	// Failed : ACLValidator verified failed
	Failed
)

Jump to

Keyboard shortcuts

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