ptree

package
v0.0.0-...-d9e9996 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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
	SignInfo *pb.SignatureInfo // the signature info of this node, only AK have this field
	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 acl.ManagerInterface, account string, aksuri []string, sign []*pb.SignatureInfo) (*PermNode, error)

BuildAccountPermTree build PermTree for account

func BuildMethodPermTree

func BuildMethodPermTree(aclMgr acl.ManagerInterface, contractName string, methodName string, aksuri []string, sign []*pb.SignatureInfo) (*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