permissions

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OPTOUT_EMITTER defines if the emitter is granted/required for the opt-out operation
	OPTOUT_EMITTER = model.Bits8(1 << iota)

	// OPTOUT_BENEFICIARY defines if the beneficiary is granted/required for the opt-out operation
	OPTOUT_BENEFICIARY

	// FEEDING_EMITTER defines if the emitter is granted/required for the feeding operation
	FEEDING_EMITTER

	// FEEDING_BENEFICIARY defines if the beneficiary is granted/required for the feeding operation
	FEEDING_BENEFICIARY

	// SPENDING_EMITTER defines if the emitter is granted/required for the spending operation
	SPENDING_EMITTER

	// SPENDING_BENEFICIARY defines if the beneficiary is granted/required for the spending operation
	SPENDING_BENEFICIARY

	// OBLIVION_EMITTER defines if the emitter is granted/required for the oblivion operation
	OBLIVION_EMITTER

	// OBLIVION_BENEFICIARY defines if the beneficiary is granted/required for the oblivion operation
	OBLIVION_BENEFICIARY
)

--- Flags for permissions

View Source
const (
	// BENEFICIARY_ONLY states that the beneficiary is required and only him, ie. permissions for an operation should be in the form "10".
	BENEFICIARY_ONLY = Stakeholder(iota)

	// EMITTER_ONLY states that the emitter is required and only him, ie. permissions for an operation should be in the form "01".
	EMITTER_ONLY

	// AT_LEAST_ONE_STAKEHOLDER states that at least one stakeholder is required, no matter whom, ie. permissions for an operation should be in the form "01" or "10".
	AT_LEAST_ONE_STAKEHOLDER

	// BOTH_STAKEHOLDERS states that both stakeholders are required, ie. permissions for an operation should be in the form "11".
	BOTH_STAKEHOLDERS

	// ANY_STAKEHOLDER states that no stakeholder is actually required, ie. any stakeholder can perform the operation, therefore permissions for this operation could be in any form (including "00").
	ANY_STAKEHOLDER
)

Variables

View Source
var DEFAULT, _ = StringToPermissions("00100100")

DEFAULT is the default permissions to set in transactions

Functions

This section is empty.

Types

type Permissions

type Permissions struct {
	model.Bits8 `json:"code"`
}

Permissions ...

func StringToPermissions

func StringToPermissions(str string) (p Permissions, err error)

StringToPermissions ...

func ToPermissions

func ToPermissions(bytes []byte) Permissions

ToPermissions ...

func (*Permissions) Requires

func (p *Permissions) Requires(s Stakeholder, on operation.Operation) bool

Requires ...

type Requirements

type Requirements struct {
	Beneficiary model.Bits8
	Emitter     model.Bits8
}

Requirements ...

func RequirementsFor

func RequirementsFor(op operation.Operation) (Requirements, error)

RequirementsFor returns the Requirements for the passed operation, or an error if any.

type Stakeholder

type Stakeholder uint

Stakeholder ...

Jump to

Keyboard shortcuts

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