owner

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package owner provides method for storing in chaincode state information about chaincode owner

Index

Constants

View Source
const OwnerStateKey = `OWNER`

OwnerStateKey key used to store owner grant struct in chain code state

View Source
const QueryMethod = `owner`

Variables

View Source
var (
	// ErrOwnerNotProvided
	ErrOwnerNotProvided = errors.New(`owner not provided`)

	// ErrOwnerAlreadySetted owner already setted
	ErrOwnerAlreadySetted = errors.New(`owner already setted`)
)
View Source
var (
	// ErrOwnerOnly error occurs when trying to invoke chaincode func  protected by onlyOwner middleware (modifier)
	ErrOwnerOnly = errors.New(`owner only`)
)

Functions

func Get

func Get(c r.Context) (*identity.Entry, error)

func IdentityEntryFromState

func IdentityEntryFromState(c r.Context) (interface{}, error)

IdentityFromState

func Insert

func Insert(c r.Context, mspID string, cert []byte) (*identity.Entry, error)

Insert

func InvokeSetFromArgs added in v0.3.0

func InvokeSetFromArgs(c router.Context) (interface{}, error)

InvokeSetFromArgs gets owner data fron args[0] (Msp Id) and arg[1] (cert)

func InvokeSetFromCreator added in v0.3.0

func InvokeSetFromCreator(c router.Context) (interface{}, error)

InvokeSetFromCreator sets tx creator as chaincode owner, if owner not previously setted

func IsInvoker

func IsInvoker(c r.Context) (bool, error)

IsInvoker checks than tx creator is chain code owner

func IsInvokerOr

func IsInvokerOr(c r.Context, allowedTo ...identity.Identity) (bool, error)

IsInvokerOr checks tx creator and compares with owner of another identity

func IsSetted

func IsSetted(c r.Context) (bool, error)

func Only

func Only(next router.HandlerFunc, pos ...int) router.HandlerFunc

Only allow access from chain code owner

func Query

func Query(c router.Context) (interface{}, error)

FromState returns raw data ( serialized Grant ) of current chain code owner

func SetFromArgs

func SetFromArgs(c r.Context) (*identity.Entry, error)

SetFromArgs set owner fron first args

func SetFromCreator

func SetFromCreator(c r.Context) (*identity.Entry, error)

SetFromCreator sets chain code owner from stub creator

Types

This section is empty.

Jump to

Keyboard shortcuts

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