views:

47

answers:

2

Hi

I want to have multiple login with in single zend application.

I have five sections A,B,C,D,E and four type of users (P,Q,R,S) including anonymous user.These section have sub sections. Section A,B,C required login to access them. Section D and E can be accessed by all type of users but there are some action that can be followed by specific type of users.

P can only login to sec A, Q can login to sec B and R can login to sec C.

Can you please suggest what directory structure I should use and how should I implement multiple login.

Thanks

A: 

You are likely looking for a Role based Access Control List.
Zend Framework offers this through Zend_Acl.

Also see:

Gordon
Thanks for this.But here I am not trying to implement ACL as I mentioned the sections also have sub sections. Section itself a panel with various modules in it and that only concerns to a particular user as P only need sec A to perform his work. section A contain sub section(modules) etc... . Same for user Q(sec-B) and R(sec-C). The section will have separate header and footer also.
Acharya
@Acharya I am not sure whether I understand. Zend_Acl can be tied to Zend_Navigation, so if this is about rendering individual navigation, it's very much possible with it. You might be talking about [Multitenancy](http://en.wikipedia.org/wiki/Multitenancy) though. If so, please disregard my answer, but update the question accordingly.
Gordon
But my question is what directory structure I should use and how should I implement multiple login. Please see above
Acharya
A: 

the directory structure has nothing to do with the access rights. your whole application could be a single controller and be capable of your roles and rights concept but would not be nice code tbh.

if you don't wanna use Zend_Acl (why not?) you could solve it by implementing a simple concept like the following:

create an application module for each of your "sections" including a PublicController in each application which will be accessible by anyone later. then you should implement a front controller plugin which could look like the folloing

public function preDispatch()
{
    $identity = Zend_Auth::getInstance()->getIdentity();        
    $module = $this->getRequest()->getModuleName();
    $controller = $this->getRequest()->getControllerName();

    if($controller == 'public') {

        return;
    }

    switch ($identity->role) {

        case 'A':
            if ($module != 'P') {
                $this->myNotAuthorized();
            }
            break;

        // cases for other roles/modules
    }
}
zolex