eZpedia : The Free eZ Publish CMS Documentation Encyclopedia

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

Article provided by eZpedia

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

Powered by eZ Publish 6.0.2stable

Hosted by USA eZ Publish Community Partner : Brookins Consulting