1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* test script for testing ldap functionality outside of Drupal
|
6
|
*
|
7
|
*/
|
8
|
|
9
|
die('Move this script outside of Drupal and uncomment the die statement in config.inc to run.'); // remove this line after moving out the scripts outside of drupal root.
|
10
|
|
11
|
function ldap_help_config() {
|
12
|
|
13
|
// these variables are just for convenience, they can be hard coded directly into the $config array
|
14
|
$provision_root = 'ou=test,ou=drupal,dc=ad,dc=mycollege,dc=edu';
|
15
|
$query_root = 'dc=ad,dc=mycollege,dc=edu';
|
16
|
$user_root = 'ou=people,dc=mycollege,dc=edu';
|
17
|
$bind_user = 'cn=drupal-ldap,ou=service accounts,dc=ad,dc=mycollege,dc=edu';
|
18
|
$bind_pwd = 'password';
|
19
|
$server_address = 'ad.mycollege.edu';
|
20
|
|
21
|
$config = array(
|
22
|
'servers' => array(
|
23
|
'default test' => array(
|
24
|
'server_address' => $server_address,
|
25
|
'server_port' => 389,
|
26
|
'server_tls' => FALSE,
|
27
|
'server_bind_method' => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT, // LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT OR LDAP_SERVERS_BIND_METHOD_ANON
|
28
|
'server_base_dn' => $user_root,
|
29
|
'server_bind_dn' => $bind_user,
|
30
|
'server_bind_pw' => $bind_pwd,
|
31
|
'test_queries' => array(
|
32
|
'user' => array(
|
33
|
'filter' => 'cn=jbarclay',
|
34
|
'show_attr' => array('dn', 'cn', 'displayname', 'sn', 'givenname', 'mail', 'samaccountname', 'email'),
|
35
|
),
|
36
|
),
|
37
|
'test_provisions' => array(),
|
38
|
),
|
39
|
'query test' => array(
|
40
|
'server_address' => $server_address,
|
41
|
'server_port' => 389,
|
42
|
'server_tls' => FALSE,
|
43
|
'server_bind_method' => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT, // LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT OR LDAP_SERVERS_BIND_METHOD_ANON
|
44
|
'server_base_dn' => $query_root,
|
45
|
'server_bind_dn' => $bind_user,
|
46
|
'server_bind_pw' => $bind_pwd,
|
47
|
'test_queries' => array(
|
48
|
'group' => array(
|
49
|
'filter' => 'cn=ed-it-nag',
|
50
|
'show_attr' => array('dn', 'cn', 'samaccountname'),
|
51
|
),
|
52
|
),
|
53
|
'test_provisions' => array(),
|
54
|
),
|
55
|
'provision test' => array(
|
56
|
'server_address' => $server_address,
|
57
|
'server_port' => 389,
|
58
|
'server_tls' => FALSE,
|
59
|
'server_bind_method' => LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT, // LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT OR LDAP_SERVERS_BIND_METHOD_ANON
|
60
|
'server_base_dn' => $provision_root,
|
61
|
'server_bind_dn' => $bind_user,
|
62
|
'server_bind_pw' => $bind_pwd,
|
63
|
'test_queries' => array(),
|
64
|
'test_provisions' => array(
|
65
|
'simple_user' => array(
|
66
|
'delete_if_exists' => TRUE,
|
67
|
'find_filter' => "distinguishedName=cn=ed-drupal-user-17,$provision_root",
|
68
|
'dn' => "cn=ed-drupal-user-17, $provision_root",
|
69
|
'attr' => array(
|
70
|
"displayName" => "Drupal User",
|
71
|
"cn" => 'ed-drupal-user-17',
|
72
|
"samaccountname" => 'ed-drupal-user-17',
|
73
|
"objectclass" => array(
|
74
|
"top", "person", "organizationalPerson", "user",
|
75
|
),
|
76
|
"description" => "test user",
|
77
|
'mail' => 'ed-drupal-user-17@blah.com',
|
78
|
'givenName' => 'Drupal',
|
79
|
'sn' => 'User',
|
80
|
'distinguishedName' => "cn=ed-drupal-user-17,$provision_root",
|
81
|
),
|
82
|
),
|
83
|
'simple_group' => array(
|
84
|
'delete_if_exists' => TRUE,
|
85
|
'find_filter' => "distinguishedName=cn=ed-drupal-group2,$provision_root",
|
86
|
'dn' => "cn=ed-drupal-group2,$provision_root",
|
87
|
'attr' => array(
|
88
|
"cn" => 'ed-drupal-group2',
|
89
|
"sAMAccountName" => 'ed-drupal-group2',
|
90
|
'instanceType' => '4',
|
91
|
"objectClass" => array(
|
92
|
"top", "group",
|
93
|
),
|
94
|
'name' => 'ed-drupal-group2',
|
95
|
'distinguishedName' => "cn=ed-drupal-group2,$provision_root",
|
96
|
),
|
97
|
),
|
98
|
),
|
99
|
),
|
100
|
),
|
101
|
);
|
102
|
|
103
|
return $config;
|
104
|
|
105
|
}
|