logo       

Re: Using Zend_Auth to retrieve a user's role to use in Zend_Acl: msg#00016

php.zend.framework.auth

Subject: Re: Using Zend_Auth to retrieve a user's role to use in Zend_Acl



On 03/10/2007, Vincent <imnotb-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:


On 03/10/2007, David Mintz < david-dMffkYQFJ3MKxoK4Ny/0iQ@xxxxxxxxxxxxxxxx> wrote:
It isn't unfortunate that you already have your own Db adapter in hand. You need it to pass to the constructor of Zend_Auth_Adapter_DbTable.

I'm not sure I understand what the problem is.

Sorry, my fault: it's not a DB adapter, but an Auth adapter...

After having read some more, I am now thinking of subclassing Zend_Auth_Result to make it include the user's role. I'm not quite sure whether this would be the best way to go about though, so I'd like to ask for some feedback on whether you guys think this to be a good idea.

Thanks,

Vincent

On 10/3/07, Vincent <imnotb-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx > wrote:

Unfortunately I already use my own DB adapter, but when I started to look how Zend_Auth_Adapter_DbTable returned a result, I started to doubt that that would work.

The page you linked to mentions the user of

$result $authAdapter
->authenticate();

echo $result->
getIdentity
() . "\n\n";

However, looking through the source I see that as an identity, $authResult['identity'] is returned, which is set to $this->_identity, which is supposed to be a string (not an object, so you shouldn't be able to do ->getIdentity() on it). I'm using Zend Framework 1.0.0, could it be that the reference is outdated?

Then you should be able to do something like

Zend_Auth::getInstance()->getStorage()->read()->role


--
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness



--
Vincent

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise