I want to add the following code only to one component named "LoginRequirement" and i want to add "LoginRequirement" as behaviour or filter to any controller that i want to redirect all not-loggedin users.
Answer to this question will really help me understand behaviours and filters.
( Note, i don’t want to use AuthManager for this )
if (Yii::app()->user->isGuest) {
Yii::app()->user->loginRequired();
}
Thank you very much! I thought that i could only use those access rules with sql database, sqlite or phpauth… and since I don’t understand the motivation behind authmanager: As far as i see i have to revoke roles for a user and save()!!! after they logout. Loading and saving continuously is frightening. That’s why i tried to stay away from it. But i see that by using accessControl, i don’t have to use roles at all! Thank you!