Snippet: PHP Snippet Assigning roles
Predefined variables
- $roleID: ID of the role
- $objectID: id of a user or user group content object you want to assign the role to
- $limitIdent: either null, Subtree or Section
- $limitValue: either null, a node path string (in case $limitIdent is 'Subtree') or a section id (in case $limitIdent is 'Section')
$role = eZRole::fetch( $roleID ); $role->assignToUser( $objectID, $limitIdent, $limitValue ); eZRole::expireCache(); eZContentCacheManager::clearAllContentCache(); eZUser::cleanupCache();