i want to change default action of a controller depends on which user is logged in.
Ex. There are two users in my site : publisher and author and i want to set publisher action as default action when a publisher is logged in, and same for author.
what should i do? when can I check my roles and set their relevant actions?
Another way to do this would be setting the
defaultActionproperty in your controller’sinit()method. Somewhat like this:Check out CAuthManager’s
getRoles(), to see that the returned array will have format of'role'=>CAuthItem object, which is why i’m checking witharray_key_exists().Incase you don’t know, the action name will be only the name without the action part, for example if you have
public function actionPublisher(){...}then action name should be:publisher.