ez.no / exponential / documentation / reference / data fetching / content / access
fetch( 'content', 'access',
hash( 'access', access,
'contentobject', contentobject,
[ 'contentclass_id', contentclass_id, ]
[ 'parent_contentclass_id', parent_contentclass_id ] ) )
| Name | Type | Description | Required |
|---|---|---|---|
| access | string | The access type in the content module to check | Yes. |
| contentobject | object | The contentobject or contentobject node to do the checking on | Yes. |
| contentclass_id | integer,string | The ID of the contentclass to include in check | No. |
| parent_contentclass_id | integer,string | The ID of the contentclass of the parent node to include in check | No. |
Returns true if the access is allowed by the current user
This fetch can be used to figure out if the current user has access (read, write, create, delete etc.) to a given object or node.
Note: When checking create access and the contentclass_id is not specified it will return true as long as there is a create access for this object, the user could still not be allowed to create a specific class.
Check if the node $node can be read by the user
fetch( 'content', 'access', hash( 'access', 'read', 'contentobject', $node ) )
Checking if a given class can be created at the current node by the user
fetch( 'content', 'access', hash( 'access', 'create', 'contentobject', $node, 'contentclass_id', 'folder' ) )
Comments