xrpld
Loading...
Searching...
No Matches
xrpl::Permission Class Reference

#include <Permissions.h>

Collaboration diagram for xrpl::Permission:

Classes

struct  GranularPermissionEntry
struct  TxDelegationEntry

Public Member Functions

 Permission (Permission const &)=delete
Permissionoperator= (Permission const &)=delete
std::optional< std::stringgetPermissionName (std::uint32_t value) const
std::optional< std::uint32_tgetGranularValue (std::string const &name) const
std::optional< std::stringgetGranularName (GranularPermissionType value) const
std::optional< TxTypegetGranularTxType (GranularPermissionType gpType) const
std::optional< std::reference_wrapper< uint256 const > > getTxFeature (TxType txType) const
bool isDelegable (std::uint32_t permissionValue, Rules const &rules) const
bool hasGranularPermissions (TxType txType) const
bool checkGranularSandbox (STTx const &tx, std::unordered_set< GranularPermissionType > const &heldPermissions) const
 Verifies a delegated transaction against its granular permission template.

Static Public Member Functions

static Permission const & getInstance ()
static uint32_t txToPermissionType (TxType type)
static std::optional< TxTypepermissionToTxType (std::uint32_t value)

Private Member Functions

 Permission ()

Private Attributes

std::unordered_set< TxTypegranularTxTypes_
std::unordered_map< TxType, TxDelegationEntrytxDelegationMap_
std::unordered_map< std::string, GranularPermissionTypegranularPermissionsByName_
std::unordered_map< GranularPermissionType, GranularPermissionEntrygranularPermissions_

Detailed Description

Definition at line 43 of file Permissions.h.

Constructor & Destructor Documentation

◆ Permission() [1/2]

xrpl::Permission::Permission ( )
private

Definition at line 39 of file Permissions.cpp.

◆ Permission() [2/2]

xrpl::Permission::Permission ( Permission const & )
delete

Member Function Documentation

◆ getInstance()

Permission const & xrpl::Permission::getInstance ( )
static

Definition at line 139 of file Permissions.cpp.

◆ operator=()

Permission & xrpl::Permission::operator= ( Permission const & )
delete

◆ getPermissionName()

std::optional< std::string > xrpl::Permission::getPermissionName ( std::uint32_t value) const
nodiscard

Definition at line 146 of file Permissions.cpp.

◆ getGranularValue()

std::optional< std::uint32_t > xrpl::Permission::getGranularValue ( std::string const & name) const
nodiscard

Definition at line 166 of file Permissions.cpp.

◆ getGranularName()

std::optional< std::string > xrpl::Permission::getGranularName ( GranularPermissionType value) const
nodiscard

Definition at line 176 of file Permissions.cpp.

◆ getGranularTxType()

std::optional< TxType > xrpl::Permission::getGranularTxType ( GranularPermissionType gpType) const
nodiscard

Definition at line 186 of file Permissions.cpp.

◆ getTxFeature()

std::optional< std::reference_wrapper< uint256 const > > xrpl::Permission::getTxFeature ( TxType txType) const
nodiscard

Definition at line 202 of file Permissions.cpp.

◆ isDelegable()

bool xrpl::Permission::isDelegable ( std::uint32_t permissionValue,
Rules const & rules ) const
nodiscard

Definition at line 216 of file Permissions.cpp.

◆ hasGranularPermissions()

bool xrpl::Permission::hasGranularPermissions ( TxType txType) const
nodiscard

Definition at line 196 of file Permissions.cpp.

◆ txToPermissionType()

uint32_t xrpl::Permission::txToPermissionType ( TxType type)
staticnodiscard

Definition at line 249 of file Permissions.cpp.

◆ permissionToTxType()

std::optional< TxType > xrpl::Permission::permissionToTxType ( std::uint32_t value)
staticnodiscard

Definition at line 255 of file Permissions.cpp.

◆ checkGranularSandbox()

bool xrpl::Permission::checkGranularSandbox ( STTx const & tx,
std::unordered_set< GranularPermissionType > const & heldPermissions ) const
nodiscard

Verifies a delegated transaction against its granular permission template.

Note
WARNING: Do not move this check before standard transaction-level format checks, which is in preclaim. This function assumes the transaction's base structural integrity (fees, sequence, signatures) has already been validated.
Parameters
txThe transaction to verify.
heldPermissionsThe granular permissions that the sender hold.
Returns
true if the transaction fields and flags comply with the granular template.

Definition at line 266 of file Permissions.cpp.

Member Data Documentation

◆ granularTxTypes_

std::unordered_set<TxType> xrpl::Permission::granularTxTypes_
private

Definition at line 68 of file Permissions.h.

◆ txDelegationMap_

std::unordered_map<TxType, TxDelegationEntry> xrpl::Permission::txDelegationMap_
private

Definition at line 69 of file Permissions.h.

◆ granularPermissionsByName_

std::unordered_map<std::string, GranularPermissionType> xrpl::Permission::granularPermissionsByName_
private

Definition at line 70 of file Permissions.h.

◆ granularPermissions_

std::unordered_map<GranularPermissionType, GranularPermissionEntry> xrpl::Permission::granularPermissions_
private

Definition at line 71 of file Permissions.h.