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