World
Reference
Internals
Access Control

AccessControl

Git Source (opens in a new tab)

Provides access control functions for checking permissions and ownership within a namespace.

Functions

hasAccess

Checks if the caller has access to the given resource ID or its namespace.

function hasAccess(ResourceId resourceId, address caller) internal view returns (bool);

Parameters

NameTypeDescription
resourceIdResourceIdThe resource ID to check access for.
calleraddressThe address of the caller.

Returns

NameTypeDescription
<none>booltrue if the caller has access, false otherwise.

requireAccess

Check for access at the given namespace or resource.

Reverts with IWorldErrors.World_AccessDenied if access is denied.

function requireAccess(ResourceId resourceId, address caller) internal view;

Parameters

NameTypeDescription
resourceIdResourceIdThe resource ID to check access for.
calleraddressThe address of the caller.

requireOwner

Check for ownership of the namespace of the given resource ID.

Reverts with IWorldErrors.World_AccessDenied if caller is not owner of the namespace of the resource.

function requireOwner(ResourceId resourceId, address caller) internal view;

Parameters

NameTypeDescription
resourceIdResourceIdThe resource ID to check ownership for.
calleraddressThe address of the caller.

requireExistence

Check for existence of the given resource ID.

Reverts with IWorldErrors.World_ResourceNotFound if the resource does not exist.

function requireExistence(ResourceId resourceId) internal view;

Parameters

NameTypeDescription
resourceIdResourceIdThe resource ID to check existence for.