From: cajus Date: Thu, 20 Sep 2007 07:31:31 +0000 (+0000) Subject: Added ACL speed optimization X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=920fb5bd6dacd9fa59bfb31ca427f9c310d440be;p=gosa.git Added ACL speed optimization git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7344 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc index f2aa91d85..749d905f5 100644 --- a/include/class_userinfo.inc +++ b/include/class_userinfo.inc @@ -64,6 +64,9 @@ class userinfo $this->dn= $userdn; $this->uid= $attrs['uid'][0]; $this->ip= $_SERVER['REMOTE_ADDR']; + + /* Initialize ACL_CACHE */ + $_SESSION['ACL_CACHE']= array(); } @@ -178,6 +181,11 @@ class userinfo function get_permissions($dn, $object, $attribute= "", $skip_write= FALSE) { + /* Push cache answer? */ + if (isset($_SESSION['ACL_CACHE']["$dn+$object+$attribute"])){ + return ($_SESSION['ACL_CACHE']["$dn+$object+$attribute"]); + } + $acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => ""); /* Build dn array */ @@ -255,6 +263,7 @@ class userinfo $ret= preg_replace('/w/', '', $ret); } + $_SESSION['ACL_CACHE']["$dn+$object+$attribute"]= $ret; return ($ret); }