UnitManager.php
1.58 KB
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
<?php
// main library routines and defaults
require_once("../../config/dmsDefaults.php");
require_once("$default->fileSystemRoot/lib/owl.lib.php");
require_once("$default->fileSystemRoot/lib/administration/UnitManager.inc");
/**
* $Id$
*
* Unit Tests for lib/administration/UnitManager.inc
*
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* @version $Revision$
* @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
* @package tests.administration
*/
echo "<pre>";
// unit tests for UnitManager methods
$um = new UnitManager();
/*
$userArray = $um->listLdapUsers($userNameSearch);
if (!userArray) {
echo "ldap user lookup failed!<br>";
} else {
print_r($userArray);
}
*/
// do some transformation of the first entry in the array?
// think maybe just set username = uid
// setup user details array
$unitID = 1;
//($userDetails['username'], $userDetails['name'], '', $userDetails['email'], $userDetails['mobile'], $userDetails['ldap_dn'])";
$userDetails = array("username" => "michael",
"name" => "michael joseph",
"email" => "michael@jamwarehouse.com",
"mobile" => "0731418818",
"ldap_dn" => "uid=michael,ou=Alcohol and Drug Abuse,ou=Environment and Development,o=Medical Research Council"
);
global $default;
$result = $um->addUser($unitID, $userDetails);
if (!$result) {
echo "add user failed!<br>";
echo "error message=" . $_SESSION["errorMessage"];
} else {
echo "added user successfully<br>";
}
echo "</pre>";
?>