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
Permission & operator= (Permission const &)=delete
std::optional< std::string > getPermissionName (std::uint32_t value) const
std::optional< std::uint32_t > getGranularValue (std::string const &name) const
std::optional< std::string > getGranularName (GranularPermissionType value) const
std::optional< TxType > getGranularTxType (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< TxType > permissionToTxType (std::uint32_t value)

Private Member Functions

 Permission ()

Private Attributes

std::unordered_set< TxType > granularTxTypes_
std::unordered_map< TxType, TxDelegationEntry > txDelegationMap_
std::unordered_map< std::string, GranularPermissionType > granularPermissionsByName_
std::unordered_map< GranularPermissionType, GranularPermissionEntry > granularPermissions_

Detailed Description

Definition at line 42 of file Permissions.h.

Constructor & Destructor Documentation

◆ Permission() [1/2]

xrpl::Permission::Permission ( )
private

Definition at line 42 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 150 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 157 of file Permissions.cpp.

◆ getGranularValue()

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

Definition at line 177 of file Permissions.cpp.

◆ getGranularName()

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

Definition at line 187 of file Permissions.cpp.

◆ getGranularTxType()

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

Definition at line 197 of file Permissions.cpp.

◆ getTxFeature()

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

Definition at line 213 of file Permissions.cpp.

◆ isDelegable()

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

Definition at line 227 of file Permissions.cpp.

◆ hasGranularPermissions()

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

Definition at line 207 of file Permissions.cpp.

◆ txToPermissionType()

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

Definition at line 260 of file Permissions.cpp.

◆ permissionToTxType()

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

Definition at line 266 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 277 of file Permissions.cpp.

Member Data Documentation

◆ granularTxTypes_

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

Definition at line 67 of file Permissions.h.

◆ txDelegationMap_

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

Definition at line 68 of file Permissions.h.

◆ granularPermissionsByName_

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

Definition at line 69 of file Permissions.h.

◆ granularPermissions_

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

Definition at line 70 of file Permissions.h.