Module: Calnet::Controller::InstanceMethods
- Defined in:
- lib/calnet_authenticated/controller.rb
Instance Method Summary collapse
- #current_user ⇒ Object
-
#current_user_required ⇒ Object
(also: #login_required)
Force the user to be have an SSO session open.
- #logged_in? ⇒ Boolean
Instance Method Details
#current_user ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/calnet_authenticated/controller.rb', line 66 def current_user load 'user.rb' unless defined?(User) @current_user ||= if( session && session[:calnetuid] ) # if the user model hasn't been loaded yet # this will return nil and fail. User.find_create_and_update_by_uid(session[:calnetuid]) else nil end end |
#current_user_required ⇒ Object Also known as: login_required
Force the user to be have an SSO session open.
60 61 62 63 |
# File 'lib/calnet_authenticated/controller.rb', line 60 def current_user_required # Have to add ".filter(self)" when not in before_filter line. CASClient::Frameworks::Rails::Filter.filter(self) end |
#logged_in? ⇒ Boolean
55 56 57 |
# File 'lib/calnet_authenticated/controller.rb', line 55 def logged_in? !current_user.nil? end |