Module: Calnet::Controller::InstanceMethods

Defined in:
lib/calnet_authenticated/controller.rb

Instance Method Summary collapse

Instance Method Details

#current_userObject



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_requiredObject 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

Returns:

  • (Boolean)


55
56
57
# File 'lib/calnet_authenticated/controller.rb', line 55

def logged_in?
	!current_user.nil?
end