This is compatible with eZ Publish 4.
The following code will login the user with the login specified by $login. It is especially useful in cronjob scripts when you need sufficient privileges.
$user = eZUser::fetchByName( $login ); $userID = $user->attribute( 'contentobject_id' ); eZUser::setCurrentlyLoggedInUser( $user, $userID );
In all recent versions of eZ publish the content/read policy limitation list of the current user gets cached in a global array by eZContentObjectTreeNode. When switching users, this cache isn't cleared. This issue has been reported as bug 8388 at ez.no and fixed in eZ Publish 4.1.x.
For your reference you can workaround this problem by clearing the cache yourself with the following code:
if ( isset( $GLOBALS['ezpolicylimitation_list']['content']['read'] ) ) { unset( $GLOBALS['ezpolicylimitation_list']['content']['read'] ); }
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