identity

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var (
	// UserNamespace holds the user identity information in the user db
	UserNamespace = []byte{0}
	// NodeNamespace holds the node identity information in the config db
	NodeNamespace = []byte{0}
)

Functions

func ConstructDBEntriesForClusterAdmins

func ConstructDBEntriesForClusterAdmins(oldAdmins, newAdmins []*types.Admin, version *types.Version) (*worldstate.DBUpdates, error)

ConstructDBEntriesForClusterAdmins constructs database entries for the cluster admins

func ConstructDBEntriesForNodes

func ConstructDBEntriesForNodes(oldNodes, newNodes []*types.NodeConfig, version *types.Version) (*worldstate.DBUpdates, error)

ConstructDBEntriesForNodes constructs database entries for the nodes present in the clusterr

func ConstructDBEntriesForUserAdminTx

func ConstructDBEntriesForUserAdminTx(tx *types.UserAdministrationTx, version *types.Version) (*worldstate.DBUpdates, error)

ConstructDBEntriesForUserAdminTx constructs database entries for the transaction that manipulates user information

func ConstructProvenanceEntriesForClusterAdmins

func ConstructProvenanceEntriesForClusterAdmins(
	userID, txID string,
	adminUpdates *worldstate.DBUpdates,
	db worldstate.DB,
) (*provenance.TxDataForProvenance, error)

ConstructProvenanceEntriesForClusterAdmins constructs provenance entries for the transaction that manipulates cluster admins

func ConstructProvenanceEntriesForNodes

func ConstructProvenanceEntriesForNodes(
	userID, txID string,
	nodeUpdates *worldstate.DBUpdates,
	db worldstate.DB,
) (*provenance.TxDataForProvenance, error)

ConstructProvenanceEntriesForNodes constructs provenance entries for the transaction that manipulates nodes present in the cluster configuration

func ConstructProvenanceEntriesForUserAdminTx

func ConstructProvenanceEntriesForUserAdminTx(
	tx *types.UserAdministrationTx,
	version *types.Version,
	db worldstate.DB,
) (*provenance.TxDataForProvenance, error)

ConstructProvenanceEntriesForUserAdminTx constructs provenance entries for the transaction that manipulates

Types

type NotFoundErr

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

NotFoundErr denotes that the id does not exist in the worldstate

func (*NotFoundErr) Error

func (e *NotFoundErr) Error() string

type Querier

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

Querier provides method to query both user and admin information

func NewQuerier

func NewQuerier(db worldstate.DB) *Querier

NewQuerier returns a querier to fetch identity and related credentials

func (*Querier) DoesUserExist

func (q *Querier) DoesUserExist(userID string) (bool, error)

DoesUserExist returns true if the given user exist. Otherwise, it return false

func (*Querier) GetAccessControl

func (q *Querier) GetAccessControl(userID string) (*types.AccessControl, error)

GetAccessControl returns the ACL defined on the userID

func (*Querier) GetCertificate

func (q *Querier) GetCertificate(userID string) (*x509.Certificate, error)

GetCertificate returns the current certificate associated with a given userID

func (*Querier) GetNode

func (q *Querier) GetNode(nodeID string) (*types.NodeConfig, *types.Metadata, error)

GetNode returns the credentials associated with the given node ID

func (*Querier) GetNodeVersion

func (q *Querier) GetNodeVersion(nodeID string) (*types.Version, error)

GetNodeVersion returns the current version of a given nodeID

func (*Querier) GetUser

func (q *Querier) GetUser(userID string) (*types.User, *types.Metadata, error)

GetUser returns the credentials associated with the given non-admin userID

func (*Querier) GetUserVersion

func (q *Querier) GetUserVersion(userID string) (*types.Version, error)

GetUserVersion returns the current version of a given userID

func (*Querier) HasAdministrationPrivilege

func (q *Querier) HasAdministrationPrivilege(userID string) (bool, error)

HasAdministrationPrivilege returns true if the given userID has privilege to perform administrative tasks

func (*Querier) HasLedgerAccess

func (q *Querier) HasLedgerAccess(userID string) (bool, error)

HasLedgerAccess check is user has access to ledger data For now, all users has this access, so only user existence validated

func (*Querier) HasReadAccessOnDataDB

func (q *Querier) HasReadAccessOnDataDB(userID, dbName string) (bool, error)

HasReadAccessOnDataDB returns true if the given userID has read access on the given dbName. Otherwise, it returns false

func (*Querier) HasReadWriteAccess

func (q *Querier) HasReadWriteAccess(userID, dbName string) (bool, error)

HasReadWriteAccess returns true if the given userID has read-write access on the given dbName. Otherwise, it returns false

Jump to

Keyboard shortcuts

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