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
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The resource ID to check access for. |
caller | address | The address of the caller. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | true if the caller has access, false otherwise. |
_hasAccess
Checks if the caller has access to the given resource ID or its namespace.
This bypasses StoreSwitch and assumes its being called within the Store, saving gas for known call contexts.
function _hasAccess(ResourceId resourceId, address caller) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The resource ID to check access for. |
caller | address | The address of the caller. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | true 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
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The resource ID to check access for. |
caller | address | The address of the caller. |
_requireAccess
Check for access at the given namespace or resource.
Reverts with IWorldErrors.World_AccessDenied if access is denied.
This bypasses StoreSwitch and assumes its being called within the Store, saving gas for known call contexts.
function _requireAccess(ResourceId resourceId, address caller) internal view;
Parameters
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The resource ID to check access for. |
caller | address | The 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
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The resource ID to check ownership for. |
caller | address | The 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.
This bypasses StoreSwitch and assumes its being called within the Store, saving gas for known call contexts.
function _requireOwner(ResourceId resourceId, address caller) internal view;
Parameters
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The resource ID to check ownership for. |
caller | address | The 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
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The resource ID to check existence for. |
_requireExistence
Check for existence of the given resource ID.
Reverts with IWorldErrors.World_ResourceNotFound if the resource does not exist.
This bypasses StoreSwitch and assumes its being called within the Store, saving gas for known call contexts.
function _requireExistence(ResourceId resourceId) internal view;
Parameters
Name | Type | Description |
---|---|---|
resourceId | ResourceId | The resource ID to check existence for. |