views:

169

answers:

3

I am creating a large web application with Zend Framework 1.10. A am new in Zend Framework(1 month experiance). Can you explain me how to create a admin module in the best way?(with own authentication). How to make this with good security? Thanks a lot.

+2  A: 

I would create AdminController in each module, then route rewriting the paths like this:

/admin/module1 => module1/AdminController
/admin/module2 => module2/AdminController

Then leverage Zend_Auth and Zend_Acl.

You will also need controller plugin which checks the credentials from Zend_Auth and a Authorization controller with login form.

But it all depends on your application.

takeshin
Yes. It is good. But I think that iy is not a best solution. I will have a lot of same controllers in all modules. Thank you for help.
Alexander.Plutov
@Alexander Better yet. Just make them extend one base abstract.
takeshin
+1  A: 

The good practice is to create admin module with own controllers and plugins.

Alexander.Plutov
That depends on your packaging model. For example on a previous project we set up the basic Admin infrastructure with an Absctract Admin_Actions class, some front controller plugins and some action helpers. Then in every module there was an admin controller that extended the Admin_Actions class. But our application called for the easy installation/removal and packaging of modules.
prodigitalson
For very basic applications, this works... for larger ones I'd say it's better practice to have all your modules (ex: blogs, cms, etc.) self-contained, each with their own admin controllers. Then it's easier to re-use them in other projects.
Adrian Schneider
+1  A: 

I have same problem but I think @takeshin way is not good solving? any one has a solution?
so I don't want to have admin module and many controller

Behrang