Package com.privatechain.access.rbac
Enum Class NodeRole
- All Implemented Interfaces:
Serializable,Comparable<NodeRole>,Constable
Enumeration of node roles in a private blockchain network.
Each role carries specific capabilities for block submission, transaction submission,
validation, and reading from the chain. This enum is used by PermissionManager
to enforce role-based access control (FR-AC-02, FR-AC-03).
Role hierarchy and capabilities
- NODE_ADMIN: Full authority. Can submit blocks, transactions, validate, read, and manage the network (add/remove peers).
- NODE_MINER: Can produce blocks and submit transactions, but cannot validate blocks produced by other nodes.
- NODE_OBSERVER: Read-only access. Can query the chain and view events but cannot submit blocks or transactions.
- Since:
- 1.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAdministrator node with unrestricted permissions.Mining node with permission to produce and submit blocks, and submit transactions.Observer node with read-only access to the chain. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRead()Returnstrueif this role is permitted to read chain data.booleanReturnstrueif this role is permitted to submit blocks.booleanReturnstrueif this role is permitted to submit transactions.booleanReturnstrueif this role is permitted to validate blocks.roleName()Returns the user-friendly name of this role.static NodeRoleReturns the enum constant of this class with the specified name.static NodeRole[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NODE_ADMIN
Administrator node with unrestricted permissions. Can submit blocks, submit transactions, validate blocks, and read all data. -
NODE_MINER
Mining node with permission to produce and submit blocks, and submit transactions. Cannot validate or review blocks (assumes the network enforces strict consensus rules). -
NODE_OBSERVER
Observer node with read-only access to the chain. Cannot submit transactions or blocks but can query state and listen to events.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
roleName
Returns the user-friendly name of this role.- Returns:
- role name (lowercase)
-
canSubmitBlock
public boolean canSubmitBlock()Returnstrueif this role is permitted to submit blocks.- Returns:
trueforNODE_ADMINandNODE_MINER
-
canSubmitTransaction
public boolean canSubmitTransaction()Returnstrueif this role is permitted to submit transactions.- Returns:
trueforNODE_ADMINandNODE_MINER
-
canValidateBlock
public boolean canValidateBlock()Returnstrueif this role is permitted to validate blocks.- Returns:
trueforNODE_ADMINonly
-
canRead
public boolean canRead()Returnstrueif this role is permitted to read chain data.- Returns:
truefor all roles
-