Skip to content

Commit 66b0bf4

Browse files
committed
LDAP is singleton
1 parent 8515522 commit 66b0bf4

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

resources/init.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,24 @@
3737
);
3838

3939
// Creates LDAP service
40-
$LDAP = new UnityLDAP(
41-
$CONFIG["ldap"]["uri"],
42-
$CONFIG["ldap"]["user"],
43-
$CONFIG["ldap"]["pass"],
44-
__DIR__ . "/../deployment/custom_user_mappings",
45-
$CONFIG["ldap"]["user_ou"],
46-
$CONFIG["ldap"]["group_ou"],
47-
$CONFIG["ldap"]["pigroup_ou"],
48-
$CONFIG["ldap"]["orggroup_ou"],
49-
$CONFIG["ldap"]["admin_group"],
50-
$CONFIG["ldap"]["user_group"],
51-
$CONFIG["ldap"]["def_user_shell"]
52-
);
40+
if (isset($GLOBALS["ldapconn"])) {
41+
$LDAP = $GLOBALS["ldapconn"];
42+
} else {
43+
$LDAP = new UnityLDAP(
44+
$CONFIG["ldap"]["uri"],
45+
$CONFIG["ldap"]["user"],
46+
$CONFIG["ldap"]["pass"],
47+
__DIR__ . "/../deployment/custom_user_mappings",
48+
$CONFIG["ldap"]["user_ou"],
49+
$CONFIG["ldap"]["group_ou"],
50+
$CONFIG["ldap"]["pigroup_ou"],
51+
$CONFIG["ldap"]["orggroup_ou"],
52+
$CONFIG["ldap"]["admin_group"],
53+
$CONFIG["ldap"]["user_group"],
54+
$CONFIG["ldap"]["def_user_shell"]
55+
);
56+
$GLOBALS["ldapconn"] = $LDAP;
57+
}
5358

5459
// Creates SQL service
5560
$SQL = new UnitySQL(

0 commit comments

Comments
 (0)