2009年9月29日星期二

Re: [fw-auth] a couple questions about customizing Zend_Auth

> used getDbSelect() to get the select and join() a table, and could not

This is a bug in Zend_Db_Select. Currently, calling join before from
causes odd SQL to be produced. It seems like fixing this issue:

http://framework.zend.com/issues/browse/ZF-6653

will probably solve yours. I have this slated for an upcoming release.

>
> and kept getting Zend_Auth_Adapter_Exception, invalid SQL statement.
>
> In any event, I gave up on this approach and am now extending
> Zend_Auth_Adapter_DbTable and overriding authenticate(). Is this a
> reasonable solution?

This is a very reasonable solution, in fact, it was designed for. You
can see that since there are several small succinct methods that you can
override in Zend_Auth_Adapter_DbTable.

> Which brings me to the next question: suppose you want to add an
> authentication failure code that means 'account disabled.' Extend
> Zend_Auth_Result and have your authenticate return an instance of it?

It sounds like you want to build an Auth model, and inside that model,
extends Zend_Auth_Adapter_DbTable to detect this situation. I would
return the standard failure constant, but also add the message that you
feel you might want to use as the failure message.

-ralph

没有评论: