Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-12-2008, 12:59 PM
Junior Member
 
Join Date: Mar 2008
Posts: 3
Default Acl/Auth

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-12-2008, 01:17 PM
xentek's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 111
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-12-2008, 02:31 PM
Junior Member
 
Join Date: Mar 2008
Posts: 3
Default

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-12-2008, 02:46 PM
xentek's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 111
Default

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:
function loginUser($username,$password)
{
     
// call zend_auth and pass it your user/pass values

In your UserController, create an action method for the form to post to:

PHP Code:
function processLoginAction()
{
   
// call your loginUser method, and pass it the username and password submitted by the form.

Hope that helps. I think you've got it though

Quote:
Originally Posted by Alix View Post
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?
Haven't gotten that far yet myself, but will be implementing soon. I'll try to report back with my findings.
__________________
- xentek
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-12-2008, 06:02 PM
Junior Member
 
Join Date: Mar 2008
Posts: 3
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:05 PM.