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 desired access method (see below). | Yes. |
contentobject | object | The target/location (either an object or a node). | Yes. |
contentclass_id | integer, string | The ID number or identifier of the class that should be included in the check. | No. |
parent_contentclass_id | integer, string | The parent node's class ID number or identifier that should be included in the check. | No. |
TRUE if access is allowed, FALSE otherwise.
This function makes it possible to find out if the current user has access (read, edit, create, remove, etc.) to a given content object or a content node. The optional parameters "contentclass_id" and "parent_content_class_id" can be used to finetune the checking. These parameters are compatible with both class ID numbers and class identifier strings. The function supports checking for the following access methods:
When checking "create" access and the "contentclass_id" is not specified, the function will return TRUE as long as there is a create access for the given object. However, the user could still not be allowed to create a specific class.
{def $test=fetch( 'content', 'access', hash( 'access', 'read', 'contentobject', $node ) )} {if $test} The current user has read access to the given node. {else} The current user does not have read access to the given node. {/if}
Checks if the content node represented by $node is can be read by the current user.
{def $test=fetch( 'content', 'access', hash( 'access', 'create', 'contentobject', $node, 'contentclass_id', 'folder' ) )} {if $test} The current user can create a folder below the given node. {else} The current user can not create a folder below the given node. {/if}
Checks if the current user can create an instance of a given class below the specified node.
Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.