Projet

Général

Profil

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

root / drupal7 / sites / all / modules / ldap / ldap_authorization / ldap_authorization_drupal_role / ldap_authorization_drupal_role.module @ b42754b9

1
<?php
2

    
3
/** @file
4
 *
5
 *  maps ldap data to drupal roles
6
 *
7
 */
8

    
9
/**
10
 * Implements hook_ldap_authorization_consumer().
11
 */
12
function ldap_authorization_drupal_role_ldap_authorization_consumer() {
13

    
14
  $types['drupal_role'] =  array(
15
    'consumer_name' => t('drupal role'),
16
    'consumer_name_plural' => t('drupal roles'),
17
    'consumer_short_name' => t('role'),
18
    'consumer_short_name_plural' => t('roles'),
19
    'consumer_description' => t('A Drupal Role.'),
20
    'consumer_class_name' => 'LdapAuthorizationConsumerDrupalRole',
21
    'consumer_class_file' => 'LdapAuthorizationConsumerRole.class.php',
22
    'consumer_module' => 'ldap_authorization_drupal_role',
23
    'consumer_mapping_directions' => '<p>Mappings should be of form:<br/>
24
<code>[ldap group representation]|[role name]</code>
25
<br/>such as:<br/>
26
<code>cn=students,ou=groups,dc=hogwarts,dc=edu|students<br/>
27
cn=faculty,ou=groups,dc=hogwarts,dc=edu|administrator
28
</code><br/>
29
or if "Convert full dn" is selected below, they should look like:
30
<br/>
31
<code>students|students<br/>
32
faculty|administrator
33
</code><br/>',
34
  );
35

    
36
  return $types;
37
}
38

    
39
/**
40
 * Implements hook_ldap_user_attrs_list_alter().
41
 *
42
 */
43

    
44
function ldap_authorization_drupal_role_ldap_user_attrs_list_alter(&$available_user_attrs, &$params) {
45

    
46
  $available_user_attrs['[property.role]'] = array(
47
    'name' => 'Property: Drupal Roles',
48
    'source' => 'depends on configuration',
49
    'configurable_to_drupal' => 0,
50
    'configurable_to_ldap' => 0,
51
    'notes' => t('configure at:') . 'admin/config/people/ldap/authorization',
52
    'direction' => LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
53
    'enabled' => TRUE,
54
    'config_module' => 'ldap_authorization_drupal_role',
55
    'prov_events' => array(LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, LDAP_USER_EVENT_CREATE_DRUPAL_USER),
56
    'prov_module' => 'ldap_authorization_drupal_role',
57
  );
58

    
59
}