Projet

Général

Profil

Révision bc175c27

Ajouté par Assos Assos il y a plus de 5 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.api.php
2 2

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

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

  
25
  if ($hook_result === FALSE) { // other module has denied user, should not override
22
function hook_ldap_authentication_allowuser_results_alter(array $ldap_user, $name, &$hook_result) {
23
  // Other module has denied user, should not override.
24
  if ($hook_result === FALSE) {
26 25
    return;
27 26
  }
28
  elseif ($hook_result === TRUE) { // other module has allowed, maybe override
27
  // Other module has allowed, maybe override.
28
  elseif ($hook_result === TRUE) {
29 29
    if (mymodule_dissapproves($ldap_user, $name)) {
30 30
      $hook_result = FALSE;
31 31
    }
32 32
  }
33

  
34 33
}
35 34

  
36 35
/**
37
 * Allow a custom module to alter $ldap_user before validating user login.
36
 * Allow a custom module to alter $ldap_user.
38 37
 *
39
 *  @param array $ldap_user
40
 *    See README.developers.txt for structure
38
 * @param array $ldap_user
39
 *   See README.developers.txt for structure.
40
 * @param array $params
41
 *   Array of parameters. Includes account key with the Drupal account as value.
41 42
 */
42
function hook_ldap_entry_alter(&$ldap_user) {
43
function hook_ldap_entry_alter(array &$ldap_user, array $params) {
43 44
  $ldap_user['mail'] = 'newmail@example.com';
44 45
}

Formats disponibles : Unified diff