I have set up Authlogic and Aegis for role based authorization.
Each time I check if a user has permission to do something, as it
stands now I have to check 'current_user' isn't empty first, like
<% if current_user and current_user.may_do_something? %>
I'd like to change it so that if the user isn't logged in, an empty
user is created with the role of 'guest', an like explained in this
@current_user = User.find_by_id(session["user_id"]) ||
User.new(:role_name => "guest")
The problem is that I have no idea how to implement this in Authlogic,
the application controller has these two methods, can anyone help out?
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
return @current_user if defined?(@current_user)
@current_user = current_user_session &&
Thanks in advance!