|
|||
|
Hi,
i am new in ZF, i am trying to make login with Zend_Acl en Zend_Auth. But i am confiused with 2 difrent tutorials and i dont understand what r the difrentses between. First of all i try it the tutorial from akrabat website Akra’s DevNotes Tutorial: Getting Started with Zend_Auth wich it uses a difrent way of Zend_Auth with Zend_Auth_Adapter_DbTable. Then i found this tutorial Using ADODB with Zend_Auth and Zend_Auth_Adapter - Hello World - by Jani and it uses a method authenticate() without a Controller,loginAction. But how can i specify a View to this authenticate() methode? greets, Alix |
|
||||
|
Hi Alix,
Zend_Auth is really a convenience method, especially when authenticating the user from a Database. Its power really shines when you start getting into the Authentication back-ends, such as using the HTTP Auth (Challenge/Response, .htpasswd). Either way, you don't really want a view to go with the methods of Zend_Auth. Create a model function, possibly as a static method, and use this to authenticate against INSIDE your action method in your user controller. Its in this action method that you would you code your login form into your view script. The action that that form calls should in turn call the model function you created that utilizes Zend_Auth. Zend_ACL is a different beast altogether. If you have a need for granular control over different resources (pages, etc) for different users than utilize that. If you have a flater access control scheme (you're either logged in, or you're not) then ACL may be overkill. Get the Zend_Auth out of the way, and then revisit ACL.
__________________
- xentek |
|
|||
|
so i have to make a statis class in model directory wich is it cheks if usersname and password and validation, and then in the Controller a class with loginAction methode wich it checks if a user already logdin or not and then it redirects to View.
is this right Construction? I also want to use Zend_Acl, becouse i wil have a diferent kind of users with difrent privleges, like admin , memeber , quest. But how do i connect this two components with each other? |
|
||||
|
Well the auth method doesn't have to be static, but it might be convenient if you want to call it from other Model/Controllers without creating an instance of the user object to call it.
so if you have a User model, put a method in it that calls Zend_Auth: PHP Code:
PHP Code:
Haven't gotten that far yet myself, but will be implementing soon. I'll try to report back with my findings.
__________________
- xentek |
|
|||
|
Thanks xentek,
wel thats my problem , i was thinking about to load the class Acl in the bootstrap class Index.php, and then some how to create the object of Acl in UserController I cant find any good tutorials about Zend_Auth with Zend_Acl :s . I did found this tut Zend_Acl / Zend_Auth Example Scenario but its very old tut and incomplete. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|