Skip to content

Instantly share code, notes, and snippets.

@jrissler
Created April 24, 2012 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrissler/2480002 to your computer and use it in GitHub Desktop.
Save jrissler/2480002 to your computer and use it in GitHub Desktop.
cas docs
#application_controller
before_filter CASClient::Frameworks::Rails::Filter
before_filter :current_user
def current_user
if session[:cas_user]
@current_user ||= User.find(:first, :conditions => ["LOWER(users.email) = ?", session[:cas_user].mb_chars.downcase], :include => [:user_collections, :main_role])
else
@current_user = nil
end
end
#login/logout
skip_before_filter CASClient::Frameworks::Rails::Filter, :only => [:forgot_password, :reset_password, :logout]
def login
redirect_to centers_path if current_user
CASClient::Frameworks::Rails::Filter.login_url(self)
end
def logout
CASClient::Frameworks::Rails::Filter.logout(self)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment