|
Tuesday 18 May 2010 5:57:17 am
Comment59141
Thanks Nicolas! No, I don't mind. There you go : Here, I am in my "BizLogin" extension, checking if the user has already been authenticated. If so,
function checkUser( &$siteBasics, $url ) {
$this->initialiseSettings();
phpBIZ::setDebug($this->bizDebugLogFile);
phpBIZ::trace('Initialising phpBIZ...');
if (!isset($PHPBIZ_CLIENT) || !is_object($PHPBIZ_CLIENT)) {
phpBIZ::client(
$this->bizHost,
$this->bizPort,
$this->bizURI,
$this->wsHost,
$this->wsPort,
$this->wsURI
);
}
phpBIZ::trace('phpBIZ initialised.');
// check BIZ authentication
if (phpBIZ::checkAuthentication()) {
// get the username
$login = phpBIZ::getUser();
$user =& eZUser::fetchByName( $login );
if ( $user and $user->isEnabled( ) ) {
$userID = $user->attribute( 'contentobject_id' );
eZBizUser::setCurrentlyLoggedInUser( $user, $userID );
}
}
return parent::checkUser($siteBasics, $url); } ... And here, I am inside my AJAX extension, which is quite simple as you'll notice, and should return (as a json string) the current authenticated user.
public static function getClientTree() {
$items = array();
$user = eZUser::currentUser();
$text = "user: login=[$user->Login] email=[$user->Email]";
array_push($items, array(
text => $text,
leaf => true
));
return json_encode($items); } Instead of getting the current user, I get 'anonymous' all the time... :/
|