Module: CalnetAuthenticated::Controller::InstanceMethods

Defined in:
lib/calnet_authenticated/controller.rb

Instance Method Summary collapse

Instance Method Details

#current_userObject



64
65
66
67
68
69
70
71
72
# File 'lib/calnet_authenticated/controller.rb', line 64

def current_user
  @current_user ||= if( session && session[:calnetuid] )
      #  if the user model hasn't been loaded yet
      #  this will return nil and fail.
      $CalnetAuthenticatedUser.find_create_and_update_by_uid(session[:calnetuid])
    else
      nil
    end
end

#current_user_requiredObject Also known as: login_required

Force the user to be have an SSO session open.



58
59
60
61
# File 'lib/calnet_authenticated/controller.rb', line 58

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

Returns:

  • (Boolean)


53
54
55
# File 'lib/calnet_authenticated/controller.rb', line 53

def logged_in?
  !current_user.nil?
end