Best Practice - User Redirection To Specific Module After Login

What should be the best practice for a particular situation where a

USER login

[indent]if User is Admin,[/indent]

[indent][indent]Goto Admin Module[/indent][/indent]

[indent]else if User is Client[/indent]

[indent][indent]Goto Client Module[/indent][/indent]

,is it ok to use this?..

[…\protected\controllers\SiteController.php]


          

                ...

                // validate user input and redirect to the previous page if valid

                if ($model->validate() && $model->login()) {

                    if Admin

                   	$this->redirect( array('/admin_m/default/index') );

                    else

                   	$this->redirect( array('/client_m/default/index') );

                }

                ...



Admin & Client is only at the same table in the database, because I implemented RBAC (Yii Extension: RBAM)

My problem is I don’t know what should be done to know if a particular user is Admin or Client.

Any Tips and Suggestions? Thanks.

as you implemented the RBAC so you can check for the user role whether the user is assigned to admin role, if assigned then redirect to admin module else redirect to client module

Thank you very much! It worked! :) I never thought of it.