Re: setAdminContainers changed to what ?

Dan Rossi <liveuser-zu2dZaOKXTSc5qR/[email protected]> Thu, 26 Jan 2006 07:29:52 +1100
Newsgroups gmane.comp.php.pear.liveuser
Message-ID <[email protected]>
Ok i finally worked out the init method had to be called on the  
internal pages too, however the perm isnt loading into the session so  
checkrights will always be false :\

array(1) {  ["ludata"]=>  array(3) {  ["auth"]=>  array(3) {   
["propertyValues"]=>  array(4) {  ["auth_user_id"]=>  string(1) "1"   
["handle"]=>  string(12) "electroteque"  ["passwd"]=>  string(32)  
"634364643466346634466346"  ["is_active"]=>  bool(true)  }   
["loggedIn"]=>  bool(true)  ["currentLogin"]=>  int(1138218888)  }   
["auth_name"]=>  string(2) "DB"  ["idle"]=> int(1138219214)  } }

here is what i have

For the login page a class is setup with this constructor

function Feeds_Admin_LiveUser_Login()
	{
		parent::Feeds_Admin_LiveUser();
		
		$logconf = array('mode' => 0666, 'timeFormat' => '%X %x');
		$logger = &Log::factory('file', 'logs/liveuser.log', 'ident',  
$logconf);
		
		
		$this->liveuser =& LiveUser::factory($this->conf);
		$this->liveuser->log->addChild($logger);
		$this->liveuser->dispatcher- 
 >addObserver(array($this,'get'),null,'LiveUser');

		


	$handle = array_key_exists('handle', $_REQUEST) ? $_REQUEST['handle']  
: null;
     $password = array_key_exists('password', $_REQUEST) ?  
$_REQUEST['password'] : null;
     $logout = array_key_exists('logout', $_REQUEST) ?  
$_REQUEST['logout'] : null;
     $remember = array_key_exists('remember', $_REQUEST) ?  
$_REQUEST['remember'] : null;
     if ($logout) {
         $this->liveuser->logout(true);
     } elseif(!$this->liveuser->isLoggedIn() || ($handle &&  
$this->liveuser->getProperty('handle') != $handle)) {
         if (!$handle) {
             $this->liveuser->login(null, null, true);
         } else {
             $this->liveuser->login($handle, $password, $remember);
         }
     }


     if (!$this->liveuser->init()) {
     var_dump($this->liveuser->getErrors());
     die();
	}

	the observer is set to that class with a method get

	function get($notification)
	{
		ob_start();
		if (method_exists($this,$notification->getNotificationName()))  
call_user_func(array($this,$notification- 
 >getNotificationName()),$notification);
		ob_end_clean();
	}

which then calls each method set within it ie

		function onUnfreeze($notification)
	{
		HTTP::redirect('index.php');
	}
	
	
	
	function onLogin($notification)
	{	
		HTTP::redirect('index.php');
	}

In the internal pages a seperate class similar to the login class is  
setup , its constructor is

function Feeds_Admin_LiveUser_Events()
	{
		parent::Feeds_Admin_LiveUser();
		$this->liveuser =& LiveUser::factory($this->conf);

		$this->liveuser->dispatcher- 
 >addObserver(array($this,'get'),null,'LiveUser');

		
		$handle = array_key_exists('handle', $_REQUEST) ? $_REQUEST['handle']  
: null;
	    $password = array_key_exists('password', $_REQUEST) ?  
$_REQUEST['password'] : null;
	    $logout = array_key_exists('logout', $_REQUEST) ?  
$_REQUEST['logout'] : null;
	    $remember = array_key_exists('remember', $_REQUEST) ?  
$_REQUEST['remember'] : null;
	    if ($logout) {
	        $this->liveuser->logout(true);
	    }
	
	    if (!$this->liveuser->init()) {
     			var_dump($this->liveuser->getErrors());
     			die();
		}
	
	
	}

but the observer methods are

function postLogout()
	{
		HTTP::redirect('login.php');
	}
	
	
	function forceLogin(&$notification)
     {
		$this->liveuser->logout(true);
     }

The baseclass for the admin pages checks the rights like

$lu = new Feeds_Admin_LiveUser_Events();
		
		if (!$lu->liveuser->checkRight(array(4,5,6))) {
			Var_Dump($_SESSION);
			exit;
			$lu->liveuser->logout(true);	
		}


What have i done wrong  then ?