class ZuoraConnect::LDAP::Connection

def authorized?

def authorized?
  ZuoraConnect::logger.debug("Authorizing user #{dn}")
  if !authenticated?
    if last_message_bad_credentials?
      ZuoraConnect::logger.debug('Not authorized because of invalid credentials.')
    elsif last_message_expired_credentials?
      ZuoraConnect::logger.debug('Not authorized because of expired credentials.')
    else
      ZuoraConnect::logger.debug('Not authorized because not authenticated.')
    end
    false
  elsif !in_required_groups?
    ZuoraConnect::logger.debug('Not authorized because not in required groups.')
    false
  else
    true
  end
end