For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2005 > LiveUser questions









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author LiveUser questions
Rodrigo Alvarez

2005-06-08, 8:58 am

Hi PEARs,

I'm trying to set up LiveUser for my next website. I want to use the
Medium perm level, so I have this $options array:

$options = array(
'autoInit' => true,
'authContainers' => array(
'test' => array(
'type' => 'DB',
'dsn' => $config['database'],
'authTableCols' => array(
'required' => array(
'auth_user_id' => array('type' => 'text', 'name' =>
'user_id'),
'handle' => array('type' => 'text', 'name' => 'handle'),
'passwd' => array('type' => 'text', 'name' =>
'password')
),
'optional' => array(
'lastlogin' => array('name' => 'lastLogin', 'type' =>
'timestamp'),
'is_active' => array('name' => 'isActive', 'type' =>
'boolean')
)
)
)
),

'permContainer' => array(
'type' => 'Medium',
'storage' => array(
'DB' => array(
'dsn' => $config['database'],
'prefix' => 'liveuser_'
)
)
)
);

I pass those options to LiveUser::factory($options), but I don't know if
this is the way to do it. At this point, $_perm and $_auth are empty
properties, that I don't know how to initialize them.

Should I use the other factory methods? Should I instantiate the
containers as shown in the pear.limbourg.org tutorial?

Please, give me some advice. Thanks in advance,

Rodrigo.
Lukas Smith

2005-06-08, 8:58 am

Rodrigo Alvarez wrote:

> $options = array(
> 'autoInit' => true,


> I pass those options to LiveUser::factory($options), but I don't know if
> this is the way to do it. At this point, $_perm and $_auth are empty
> properties, that I don't know how to initialize them.


since you have the autoInit option enabled it will try to initialize the
auth and perm containers on object creation. Since this did not seem to
succeed, you need to check why things failed:

$LU = LiveUser::factory();
$LU->getErrors();
$LU->getStatus();
echo $LU->getStatusMessage($LU->getStatus());

if you disable autoInit and instead call the init() method manually, you
will find that if anything failed in the authentication you will get a
false as the return value.

regards,
Lukas
Rodrigo Alvarez

2005-06-08, 8:58 am

>
>
>
> since you have the autoInit option enabled it will try to initialize the
> auth and perm containers on object creation. Since this did not seem to
> succeed, you need to check why things failed:
>
> $LU = LiveUser::factory();

I call it passing the $options array;

$LU->init() returns false;

> $LU->getErrors();

returns an empty array.
> $LU->getStatus();

Returns -6
> echo $LU->getStatusMessage($LU->getStatus());

It seems that this method is not defined.

I'm still looking for the error.

Regards,

Rodrigo.
Lukas Smith

2005-06-08, 3:58 pm

Rodrigo Alvarez wrote:

>
> It seems that this method is not defined.


echo $LU->statusMessage($LU->getStatus());

regards,
Lukas
Rodrigo Alvarez

2005-06-08, 3:58 pm

Lukas Smith wrote:

>
> echo $LU->statusMessage($LU->getStatus());
>

An undefined error occurred :(

Regards,
Rodrigo.
Lukas Smith

2005-06-08, 3:58 pm

Rodrigo Alvarez wrote:
> Lukas Smith wrote:
>
> An undefined error occurred :(


hmm ok this should not happen if you have 'autoInit' enabled.
which version of LiveUser are you using?

regards,
Lukas
Lukas Smith

2005-06-08, 3:58 pm

Rodrigo Alvarez wrote:

> I pass those options to LiveUser::factory($options), but I don't know if
> this is the way to do it. At this point, $_perm and $_auth are empty
> properties, that I don't know how to initialize them.


you also need to pass the user credentials with the factory() call if
you use init() in most situations (unless the remmeber me cookie is
being used)..

http://pear.php.net/package/LiveUse...l#methodfactory

regards,
Lukas
Rodrigo Alvarez

2005-06-08, 3:58 pm

>>>
>
>
> hmm ok this should not happen if you have 'autoInit' enabled.
> which version of LiveUser are you using?
>


1.15.1 (the last one)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com