permission

package
v2.5.5+incompatible Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotNetworkAdmin    = ExecStatus{false, "Operation can be performed by network admin only. Account not a network admin."}
	ErrNotOrgAdmin        = ExecStatus{false, "Operation can be performed by org admin only. Account not a org admin."}
	ErrNodePresent        = ExecStatus{false, "EnodeId already part of network."}
	ErrInvalidNode        = ExecStatus{false, "Invalid enode id"}
	ErrInvalidAccount     = ExecStatus{false, "Invalid account id"}
	ErrOrgExists          = ExecStatus{false, "Org already exists"}
	ErrPendingApprovals   = ExecStatus{false, "Pending approvals for the organization. Approve first"}
	ErrNothingToApprove   = ExecStatus{false, "Nothing to approve"}
	ErrOpNotAllowed       = ExecStatus{false, "Operation not allowed"}
	ErrNodeOrgMismatch    = ExecStatus{false, "Enode id passed does not belong to the organization."}
	ErrBlacklistedNode    = ExecStatus{false, "Blacklisted node. Operation not allowed"}
	ErrBlacklistedAccount = ExecStatus{false, "Blacklisted account. Operation not allowed"}
	ErrAccountOrgAdmin    = ExecStatus{false, "Account already org admin for the org"}
	ErrOrgAdminExists     = ExecStatus{false, "Org admin exists for the org"}
	ErrAccountInUse       = ExecStatus{false, "Account already in use in another organization"}
	ErrRoleExists         = ExecStatus{false, "Role exists for the org"}
	ErrRoleActive         = ExecStatus{false, "Accounts linked to the role. Cannot be removed"}
	ErrAdminRoles         = ExecStatus{false, "Admin role cannot be removed"}
	ErrInvalidOrgName     = ExecStatus{false, "Org id cannot contain special characters"}
	ErrInvalidParentOrg   = ExecStatus{false, "Invalid parent org id"}
	ErrAccountNotThere    = ExecStatus{false, "Account does not exists"}
	ErrOrgNotOwner        = ExecStatus{false, "Account does not belong to this org"}
	ErrMaxDepth           = ExecStatus{false, "Max depth for sub orgs reached"}
	ErrMaxBreadth         = ExecStatus{false, "Max breadth for sub orgs reached"}
	ErrNodeDoesNotExists  = ExecStatus{false, "Node does not exists"}
	ErrOrgDoesNotExists   = ExecStatus{false, "Org does not exists"}
	ErrInactiveRole       = ExecStatus{false, "Role is already inactive"}
	ErrInvalidRole        = ExecStatus{false, "Invalid role"}
	ErrInvalidInput       = ExecStatus{false, "Invalid input"}
	ErrNotMasterOrg       = ExecStatus{false, "Org is not a master org"}

	ExecSuccess = ExecStatus{true, "Action completed successfully"}
)

Functions

func ParsePermissionConfig

func ParsePermissionConfig(dir string) (types.PermissionConfig, error)

function reads the permissions config file passed and populates the config structure accordingly

Types

type AccountUpdateAction

type AccountUpdateAction int
const (
	SuspendAccount AccountUpdateAction = iota + 1
	ActivateSuspendedAccount
	BlacklistAccount
	RecoverBlacklistedAccount
	ApproveBlacklistedAccountRecovery
)

type ExecStatus

type ExecStatus struct {
	Status bool   `json:"status"`
	Msg    string `json:"msg"`
}

func (ExecStatus) OpStatus

func (e ExecStatus) OpStatus() (string, error)

type NodeOperation

type NodeOperation uint8
const (
	NodeAdd NodeOperation = iota
	NodeDelete
)

type NodeUpdateAction

type NodeUpdateAction int
const (
	SuspendNode NodeUpdateAction = iota + 1
	ActivateSuspendedNode
	BlacklistNode
	RecoverBlacklistedNode
	ApproveBlacklistedNodeRecovery
)

type OrgUpdateAction

type OrgUpdateAction int
const (
	SuspendOrg OrgUpdateAction = iota + 1
	ActivateSuspendedOrg
)

type PendingOpInfo

type PendingOpInfo struct {
	PendingKey string `json:"pendingKey"`
	PendingOp  string `json:"pendingOp"`
}

type PermAction

type PermAction int

PermAction represents actions in permission contract

const (
	AddOrg PermAction = iota
	ApproveOrg
	AddSubOrg
	UpdateOrgStatus
	ApproveOrgStatus
	AddNode
	UpdateNodeStatus
	AssignAdminRole
	ApproveAdminRole
	AddNewRole
	RemoveRole
	AddAccountToOrg
	ChangeAccountRole
	UpdateAccountStatus
	InitiateNodeRecovery
	InitiateAccountRecovery
	ApproveNodeRecovery
	ApproveAccountRecovery
)

type PermissionCtrl

type PermissionCtrl struct {
	// contains filtered or unexported fields
}

func NewQuorumPermissionCtrl

func NewQuorumPermissionCtrl(stack *node.Node, pconfig *types.PermissionConfig) (*PermissionCtrl, error)

Create a service instance for permissioning

Permission Service depends on the following: 1. EthService to be ready 2. Downloader to sync up blocks 3. InProc RPC server to be ready

func (*PermissionCtrl) APIs

func (p *PermissionCtrl) APIs() []rpc.API

func (*PermissionCtrl) AfterStart

func (p *PermissionCtrl) AfterStart() error

This is to make sure all contract instances are ready and initialized

Required to be call after standard service start lifecycle

func (*PermissionCtrl) Protocols

func (p *PermissionCtrl) Protocols() []p2p.Protocol

func (*PermissionCtrl) Start

func (p *PermissionCtrl) Start(srvr *p2p.Server) error

func (*PermissionCtrl) Stop

func (p *PermissionCtrl) Stop() error

type QuorumControlsAPI

type QuorumControlsAPI struct {
	// contains filtered or unexported fields
}

QuorumControlsAPI provides an API to access Quorum's node permission and org key management related services

func NewQuorumControlsAPI

func NewQuorumControlsAPI(p *PermissionCtrl) *QuorumControlsAPI

NewQuorumControlsAPI creates a new QuorumControlsAPI to access quorum services

func (*QuorumControlsAPI) AcctList

func (q *QuorumControlsAPI) AcctList() []types.AccountInfo

func (*QuorumControlsAPI) AddAccountToOrg

func (q *QuorumControlsAPI) AddAccountToOrg(acct common.Address, orgId string, roleId string, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) AddNewRole

func (q *QuorumControlsAPI) AddNewRole(orgId string, roleId string, access uint8, isVoter bool, isAdmin bool, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) AddNode

func (q *QuorumControlsAPI) AddNode(orgId string, url string, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) AddOrg

func (q *QuorumControlsAPI) AddOrg(orgId string, url string, acct common.Address, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) AddSubOrg

func (q *QuorumControlsAPI) AddSubOrg(porgId, orgId string, url string, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) ApproveAdminRole

func (q *QuorumControlsAPI) ApproveAdminRole(orgId string, acct common.Address, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) ApproveBlackListedAccountRecovery

func (q *QuorumControlsAPI) ApproveBlackListedAccountRecovery(orgId string, acctId common.Address, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) ApproveBlackListedNodeRecovery

func (q *QuorumControlsAPI) ApproveBlackListedNodeRecovery(orgId string, enodeId string, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) ApproveOrg

func (q *QuorumControlsAPI) ApproveOrg(orgId string, url string, acct common.Address, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) ApproveOrgStatus

func (q *QuorumControlsAPI) ApproveOrgStatus(orgId string, status uint8, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) AssignAdminRole

func (q *QuorumControlsAPI) AssignAdminRole(orgId string, acct common.Address, roleId string, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) ChangeAccountRole

func (q *QuorumControlsAPI) ChangeAccountRole(acct common.Address, orgId string, roleId string, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) GetOrgDetails

func (q *QuorumControlsAPI) GetOrgDetails(orgId string) (types.OrgDetailInfo, error)

func (*QuorumControlsAPI) NodeList

func (q *QuorumControlsAPI) NodeList() []types.NodeInfo

func (*QuorumControlsAPI) OrgList

func (q *QuorumControlsAPI) OrgList() []types.OrgInfo

func (*QuorumControlsAPI) RecoverBlackListedAccount

func (q *QuorumControlsAPI) RecoverBlackListedAccount(orgId string, acctId common.Address, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) RecoverBlackListedNode

func (q *QuorumControlsAPI) RecoverBlackListedNode(orgId string, enodeId string, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) RemoveRole

func (q *QuorumControlsAPI) RemoveRole(orgId string, roleId string, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) RoleList

func (q *QuorumControlsAPI) RoleList() []types.RoleInfo

func (*QuorumControlsAPI) UpdateAccountStatus

func (q *QuorumControlsAPI) UpdateAccountStatus(orgId string, acct common.Address, status uint8, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) UpdateNodeStatus

func (q *QuorumControlsAPI) UpdateNodeStatus(orgId string, url string, action uint8, txa ethapi.SendTxArgs) (string, error)

func (*QuorumControlsAPI) UpdateOrgStatus

func (q *QuorumControlsAPI) UpdateOrgStatus(orgId string, status uint8, txa ethapi.SendTxArgs) (string, error)

Directories

Path Synopsis
contract
gen

Jump to

Keyboard shortcuts

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