Projet

Général

Profil

Paste
Télécharger (1,01 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ldap / ldap_authentication / ldap_authentication.api.php @ 5136ce55

1
<?php
2

    
3
/**
4
 * @file
5
 * summary of hooks and other developer related functions
6
 */
7

    
8
/**
9
 * Allow a custom module to examine the user's ldap details
10
 * and refuse authentication.  See also: http://drupal.org/node/1634930
11
 *
12
 *  @param array $ldap_user
13
 *    See README.developers.txt for structure
14
 *  @param string $name
15
 *    The drupal account name or proposed drupal account name if none exists yet
16
 *  @param boolean $hook_result
17
 *    TRUE for allow, FALSE for deny.
18
 *    If set to TRUE or FALSE, another module has already set this and function should
19
 *    be careful about overriding this.
20
 *
21
 *  @return boolean &$hook_result passed by reference
22
 */
23

    
24
function hook_ldap_authentication_allowuser_results_alter($ldap_user, $name, &$hook_result) {
25

    
26
  if ($hook_result === FALSE) { // other module has denied user, should not override
27
    return;
28
  }
29
  elseif ($hook_result === TRUE) { // other module has allowed, maybe override
30
    if (mymodule_dissapproves($ldap_user, $name)) {
31
      $hook_result = FALSE;
32
    }
33
  }
34

    
35
}
36

    
37