def authorized?
DeviseLdapAuthenticatable::Logger.send("Authorizing user #{dn}")
if !authenticated?
if last_message_bad_credentials?
DeviseLdapAuthenticatable::Logger.send("Not authorized because of invalid credentials.")
elsif last_message_expired_credentials?
DeviseLdapAuthenticatable::Logger.send("Not authorized because of expired credentials.")
else
DeviseLdapAuthenticatable::Logger.send("Not authorized because not authenticated.")
end
return false
elsif !in_required_groups?
DeviseLdapAuthenticatable::Logger.send("Not authorized because not in required groups.")
return false
elsif !has_required_attribute?
DeviseLdapAuthenticatable::Logger.send("Not authorized because does not have required attribute.")
return false
elsif !has_required_attribute_presence?
DeviseLdapAuthenticatable::Logger.send("Not authorized because does not have required attribute present.")
return false
else
return true
end
end