types

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountPermissions

type AccountPermissions struct {
	Base  BasePermissions
	Roles []string
}

func (*AccountPermissions) AddRole

func (ap *AccountPermissions) AddRole(role string) bool

Returns true if the role is added, and false if it already exists

func (*AccountPermissions) Clone added in v0.16.0

Clone clones the account permissions

func (AccountPermissions) HasRole

func (ap AccountPermissions) HasRole(role string) bool

Returns true if the role is found

func (*AccountPermissions) RmRole

func (ap *AccountPermissions) RmRole(role string) bool

Returns true if the role is removed, and false if it is not found

type BasePermissions

type BasePermissions struct {
	// bit array with "has"/"doesn't have" for each permission
	Perms PermFlag

	// bit array with "set"/"not set" for each permission (not-set should fall back to global)
	SetBit PermFlag
}

Base chain permissions struct

func (BasePermissions) Compose added in v0.18.0

func (bp BasePermissions) Compose(bpFallthrough BasePermissions) BasePermissions

Returns a BasePermission that matches any permissions set on this BasePermission and falls through to any permissions set on the bpFallthrough

func (BasePermissions) Get

func (bp BasePermissions) Get(ty PermFlag) (bool, error)

Gets the permission value. ErrValueNotSet is returned if the permission's set bits are not all on, and should be caught by caller so the global permission can be fetched

func (BasePermissions) IsSet

func (bp BasePermissions) IsSet(ty PermFlag) bool

Check if the permission is set

func (BasePermissions) ResultantPerms added in v0.16.0

func (bp BasePermissions) ResultantPerms() PermFlag

Returns the Perms PermFlag masked with SetBit bit field to give the resultant permissions enabled by this BasePermissions

func (*BasePermissions) Set

func (bp *BasePermissions) Set(ty PermFlag, value bool) error

Set a permission bit. Will set the permission's set bit to true.

func (BasePermissions) String

func (bp BasePermissions) String() string

func (*BasePermissions) Unset

func (bp *BasePermissions) Unset(ty PermFlag) error

Set the permission's set bits to false

type ErrInvalidPermission

type ErrInvalidPermission PermFlag

permission number out of bounds

func (ErrInvalidPermission) Error

func (e ErrInvalidPermission) Error() string

type ErrValueNotSet

type ErrValueNotSet PermFlag

set=false. This error should be caught and the global value fetched for the permission by the caller

func (ErrValueNotSet) Error

func (e ErrValueNotSet) Error() string

type PermFlag

type PermFlag uint64

A particular permission

Jump to

Keyboard shortcuts

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