Module: LdapRails::ControllerExtensions

Defined in:
lib/ldap-rails/controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#ldap_userObject



3
4
5
6
7
8
9
# File 'lib/ldap-rails/controller_extensions.rb', line 3

def ldap_user
  if session[:ldap_user]
    @ldap_user = LdapRails::LdapUser.new session[:ldap_user]
  end

  return @ldap_user
end

#require_ldap_authObject



11
12
13
14
15
16
17
# File 'lib/ldap-rails/controller_extensions.rb', line 11

def require_ldap_auth
  if ldap_user.nil?
    session[:return_to] = request.path
    flash[:error] = "You must log in."
    redirect_to 
  end
end