File: ldapgroups.module

package info (click to toggle)
drupal6-mod-ldap-integration 1.0~beta2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 280 kB
  • ctags: 4
  • sloc: pascal: 1,057; makefile: 30
file content (62 lines) | stat: -rw-r--r-- 1,954 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
// $Id: ldapgroups.module,v 1.40 2009/08/25 13:23:37 miglius Exp $

/**
 * @file
 * ldapgroups integrates ldap groups with drupal roles.
 */

//////////////////////////////////////////////////////////////////////////////

define('LDAPGROUPS_DEFAULT_DN_ATTRIBUTE',      'ou');
define('LDAPGROUPS_DEFAULT_ENTRIES_ATTRIBUTE', 'memberUid');

//////////////////////////////////////////////////////////////////////////////
// Core API hooks

/**
 * Implementation of hook_menu().
 */
function ldapgroups_menu() {
  return array(
    'admin/settings/ldap/ldapgroups' => array(
      'title' => 'Groups',
      'description' => 'Configure LDAP groups to Drupal roles mapping settings.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('ldapgroups_admin_settings'),
      'access arguments' => array('administer ldap modules'),
      'file' => 'ldapgroups.admin.inc',
    ),
    'admin/settings/ldap/ldapgroups/edit' => array(
      'title' => 'Groups',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('ldapgroups_admin_edit', 4, 5),
      'type' => MENU_CALLBACK,
      'access arguments' => array('administer ldap modules'),
      'file' => 'ldapgroups.admin.inc',
    ),
    'admin/settings/ldap/ldapgroups/reset' => array(
      'title' => 'Groups',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('ldapgroups_admin_edit', 4, 5),
      'type' => MENU_CALLBACK,
      'weight' => 1,
      'access arguments' => array('administer ldap modules'),
      'file' => 'ldapgroups.admin.inc',
    ),
  );
}

/**
 * Implements hook_user().
 */
function ldapgroups_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'login':
      require_once(drupal_get_path('module', 'ldapgroups') .'/includes/LDAPInterface.inc');
      require_once(drupal_get_path('module', 'ldapgroups') .'/ldapgroups.inc');
      ldapgroups_user_login($account);
      break;
  }
}