Handles fine-grained authorization for object relations.

Grants control who can initiate (from) or accept (to) object-to-object relations, scoped by direction, relation ID, kind, and set.

Functions

grantFrom

Issues a grant to allow initiating relations from a tail object

function grantFrom(uint128 tail, RelationGrant memory grant) external;

Parameters

NameTypeDescription
tailuint128Tail object ID
grantRelationGrantGrant details

revokeFrom

Revokes a previously issued from grant

function revokeFrom(uint128 tail, uint32 grantId) external;

Parameters

NameTypeDescription
tailuint128Tail object ID
grantIduint32Grant ID to revoke

grantTo

Issues a grant to allow accepting relations to a head object

function grantTo(uint128 head, RelationGrant memory grant) external;

Parameters

NameTypeDescription
headuint128Head object ID
grantRelationGrantGrant details

revokeTo

Revokes a previously issued to grant

function revokeTo(uint128 head, uint32 grantId) external;

Parameters

NameTypeDescription
headuint128Head object ID
grantIduint32Grant ID to revoke

allowFrom

Checks whether a sender is authorized to initiate a relation from a tail object

function allowFrom(uint32 grantId, address sender, uint128 tail, uint64 rel, uint64 headKind, uint64 headSet)
    external
    view
    returns (bool allowed);

Parameters

NameTypeDescription
grantIduint32Grant ID to check
senderaddressAddress attempting the action
tailuint128Tail object ID
reluint64Relation ID
headKinduint64Kind ID of the target (head) object
headSetuint64Set ID of the target (head) object

Returns

NameTypeDescription
allowedboolTrue if authorized

allowTo

Checks whether a sender is authorized to accept a relation to a head object

function allowTo(uint32 grantId, address sender, uint128 head, uint64 rel, uint64 tailKind, uint64 tailSet)
    external
    view
    returns (bool allowed);

Parameters

NameTypeDescription
grantIduint32Grant ID to check
senderaddressAddress attempting the action
headuint128Head object ID
reluint64Relation ID
tailKinduint64Kind ID of the source (tail) object
tailSetuint64Set ID of the source (tail) object

Returns

NameTypeDescription
allowedboolTrue if authorized

Events

GrantFrom

Emitted when a grant is issued to authorize initiating a relation from a tail object

event GrantFrom(uint128 tail, RelationGrant grant);

Parameters

NameTypeDescription
tailuint128Tail object ID (initiator)
grantRelationGrantGrant definition

RevokeFrom

Emitted when a grant from a tail object is revoked

event RevokeFrom(uint128 tail, uint32 grantId);

Parameters

NameTypeDescription
tailuint128Tail object ID (initiator)
grantIduint32ID of the revoked grant

GrantTo

Emitted when a grant is issued to authorize accepting a relation to a head object

event GrantTo(uint128 head, RelationGrant grant);

Parameters

NameTypeDescription
headuint128Head object ID (receiver)
grantRelationGrantGrant definition

RevokeTo

Emitted when a grant to a head object is revoked

event RevokeTo(uint128 head, uint32 grantId);

Parameters

NameTypeDescription
headuint128Head object ID (receiver)
grantIduint32ID of the revoked grant