You are here

function hook_ldap_user_deny_alter in LDAP integration 6

Allow other modules (e.g. ldapgroups) to deny ldap user access to the server.

Called after ldap user authenticated and mapped to Drupal account (if any) but before new account creation / existing account updates.

Parameters

boolean $denied If set to TRUE, the account will be denied.: Implementors should not reset to FALSE.

LDAPInterface $ldap LDAP server interface object bound to server as ldap user.:

String $name The ldap user name (from login form):

String $dn The DN for the authenticated user:

Object $account The local drupal account object or FALSE if none found.:

1 function implements hook_ldap_user_deny_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

ldapgroups_ldap_user_deny_alter in ./ldapgroups.module
Implementation of hook_ldap_user_deny_alter.
1 invocation of hook_ldap_user_deny_alter()
ldapauth_user_denied in includes/ldap.core.inc
Allows other modules (like ldapgroups) to deny an ldap user access to the server.

File

./ldapauth.api.php, line 112
LDAPAuth API function documentation

Code

function hook_ldap_user_deny_alter(&$denied, $ldap, $name, $dn, $account) {

  // Some example code to deny if homedirectory attribute not set
  $ldap = ldapauth_user_lookup_by_dn($ldap, $dn, LDAPAUTH_SYNC_CONTEXT_AUTHENTICATE_DRUPAL_USER);
  if (!isset($ldap['homedirectory'][0])) {

    //Note attribute name must be lowercase
    $denied = TRUE;
  }
}