You are here

function ldap_authentication_ldap_authenticated in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.2 ldap_authentication/ldap_authentication.module \ldap_authentication_ldap_authenticated()
  2. 8.3 ldap_authentication/ldap_authentication.module \ldap_authentication_ldap_authenticated()
  3. 7.2 ldap_authentication/ldap_authentication.module \ldap_authentication_ldap_authenticated()

Parameters

object $user:

Return value

boolean true if user is recorded as ldap authenticated and identified (ldap_authentified)

notes to developers

  • make user object explicit for clarity; don't default to current user as admins could be editing profile pages
  • don't use $user->data['ldap_authentified'] as it is geared toward ldap_authentication data, not where the user is currently ldap authenticated

-

5 calls to ldap_authentication_ldap_authenticated()
ldap_authentication_show_ldap_help_link in ldap_authentication/ldap_authentication.module
ldap_authentication_show_reset_pwd in ldap_authentication/ldap_authentication.module
ldap_authentication_user_pass_validate in ldap_authentication/ldap_authentication.module
_ldap_authentication_form_user_profile_form_alter in ldap_authentication/ldap_authentication.inc
_ldap_authorizations_user_authorizations in ldap_authorization/ldap_authorization.inc
return all desired authorizations for a given user

File

ldap_authentication/ldap_authentication.module, line 180
This module injects itself into Drupal's Authentication stack.

Code

function ldap_authentication_ldap_authenticated($user) {
  if (is_numeric($user)) {
    $user = @user_load((int) $user);
  }
  if (!is_object($user) || $user->uid == 0) {
    return FALSE;
  }
  $authmaps = db_query("SELECT module, authname FROM {authmap} WHERE uid = :uid", array(
    ':uid' => $user->uid,
  ))
    ->fetchAllKeyed();
  return isset($authmaps['ldap_authentication']);
}