From 3c42706a5f7d46d31a6a36ae194816d4aec78397 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 21 Nov 2010 14:32:54 +0000 Subject: [PATCH] cache OUs --- lam/lib/modules.inc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index d8b1b843..c20c8580 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -1030,7 +1030,11 @@ class accountContainer { /** True if this is a newly created account */ public $isNewAccount; + /** name of last loaded account profile */ private $lastLoadedProfile = ''; + + /** cache for existing OUs */ + private $cachedOUs = null; /** * Returns the account module with the given class name @@ -1573,14 +1577,14 @@ class accountContainer { echo "\n"; @@ -2136,6 +2140,20 @@ class accountContainer { $parent = substr($dn, strpos($dn, ",") + 1); return $parent; } + + /** + * Returns a list of OUs that exist for this account type. + * + * @return array OU list + */ + private function getOUs() { + if ($this->cachedOUs != null) { + return $this->cachedOUs; + } + $rootsuffix = $_SESSION['config']->get_Suffix($this->type); + $this->cachedOUs = $_SESSION['ldap']->search_units($rootsuffix); + return $this->cachedOUs; + } /** * Encrypts sensitive data before storing in session.