Let us say I have 4 controllers and each controller has 4 actions .
After successful registration ,if user signs-in I take him to setAddress action . This is a mandatory step and I shouldn’t allow user to access any other actions until he sets his address . I am checking a condition( his address set or not) after he signs-in and taking him to the setAddress action .
But after sign in if user manually tries to access some other action I have to force him to setAddress action if his/her address is not set, Do I have to add that condition check in all controllers actions to force the user to the above mentioned setAddress action . This makes me to write that condition in 16 actions . I think there should be some thing easier .
This sounds like a good application of access control filters and rules. You can create different roles for different levels of access. In your case, you’d have a basic role assigned when registration is complete, followed by a different role when setAddress is complete. Each controller would have to have the access control filter, etc. in place. If you wanted to get fancy, you could create a new base controller and extend it for any controller that you wanted to protect. You’d have to find a way of dynamically specifying the actions. This link looks interesting: Get Internal Actions of a Controller
Thank You bglee for your quick response , I am looking at componets\Controller.php class . May be some thing I should put here , something that gets executed before my controller action gets executed . But not finding the callback method that I have to put in this class .
If any one has any good approach or the code that helps me to put in the above Controller class