eZpedia : The Free eZ Publish CMS Documentation Encyclopedia

Snippet: PHP Snippet Assigning roles

This is compatible with eZ Publish 4.

This is a Stub article. Help the eZ Publish community by expanding it!

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();

Article provided by eZpedia

All text is available under the terms of the GNU Free Documentation License

Powered by eZ Publish Community Project 4.2011

Hosted by Swiss eZ Publish partner YMC