跳到主要内容

hasPermission

Contract: JBOperatorStore​‌

Interface: IJBOperatorStore

Whether or not an operator has the permission to take a certain action pertaining to the specified domain.

Definition

function hasPermissions(
address _operator,
address _account,
uint256 _domain,
uint256[] calldata _permissionIndexes
) external view override returns (bool) { ... }
  • _operator is the operator to check
  • _account is the account that has given out permission to the operator.
  • _domain is the domain that the operator has been given permissions to operate.
  • _permissionIndexes are the permission index to check for.
  • The view function can be accessed externally by anyone.
  • The view function does not alter state on the blockchain.
  • The function overrides a function definition from the IJBOperatorStore interface.
  • The function returns a flag indicating whether the operator has the specified permission.

Body

  1. Make sure the _permissionIndex is one of the 255 indexes in a uint256.

    if (_permissionIndex > 255) revert PERMISSION_INDEX_OUT_OF_BOUNDS();
  2. Return true if the bit is flipped on for the specified permission index. Otherwise return false.

    return (((permissionsOf[_operator][_account][_domain] >> _permissionIndex) & 1) == 1)

    Internal references: