Code

Enhanced reload of menu, iconmenu and ACLs.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Jul 2008 12:46:23 +0000 (12:46 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Jul 2008 12:46:23 +0000 (12:46 +0000)
-If class_location has changed, recreate menus and reload ACLs. Triggered by config->check_and_reload() in main.php

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11559 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_config.inc
gosa-core/include/class_pluglist.inc

index 64039fd3a115e36bd2544cbe461fc360d35180a7..b9d34dc6f47d4e5ffbf99a7e46df8658c3854875 100644 (file)
@@ -70,6 +70,32 @@ class config  {
   
   function check_and_reload()
   {
+
+    /* Check if class_location.inc has changed, this is the case 
+        if we have installed or removed plugins. 
+     */
+    if(session::is_set("class_location.inc:timestamp")){
+      $tmp = stat("../include/class_location.inc");
+      if($tmp['mtime'] != session::get("class_location.inc:timestamp")){
+
+        /* Refresh users ACLs */
+        $ui= get_userinfo();
+        $ui->loadACL();
+        session::set('ui',$ui);
+
+        /* Reset menu and iconmenu */
+        if(session::is_set("plist")){
+          $plist = session::get("plist");
+          $plist->reset_menus();
+          session::set("plist",$plist);
+        }
+      }
+    }
+    $tmp = stat("../include/class_location.inc");
+    session::set("class_location.inc:timestamp",$tmp['mtime']);
+
+
+
     if($this->filename != "" && filemtime($this->filename) != $this->last_modified){
 
       $this->config_found= FALSE;
index a1937cafdc41e092211ed03f75f197a42f020a49..ba3288a63de2bcf49940029154be2c300c95c3b1 100644 (file)
@@ -142,18 +142,6 @@ class pluglist {
 
        function gen_menu()
        {
-    /* Check if class_location.inc has changed, this is the case 
-        if we have installed or removed plugins. 
-     */
-    if(session::is_set("class_location.inc:timestamp")){
-      $tmp = stat("../include/class_location.inc");
-      if($tmp['mtime'] != session::get("class_location.inc:timestamp")){
-        $this->menu = "";
-      }
-    }
-    $tmp = stat("../include/class_location.inc");
-    session::set("class_location.inc:timestamp",$tmp['mtime']);
-
                if ($this->menu == ""){
                        $first= TRUE;
                        $cfg= $this->config->data['MENU'];
@@ -265,19 +253,6 @@ class pluglist {
        function show_iconmenu()
        {
                global $class_mapping;
-
-    /* Check if class_location.inc has changed, this is the case 
-        if we have installed or removed plugins. 
-     */
-    if(session::is_set("class_location.inc:timestamp")){
-      $tmp = stat("../include/class_location.inc");
-      if($tmp['mtime'] != session::get("class_location.inc:timestamp")){
-        $this->iconmenu = "";
-      }
-    }
-    $tmp = stat("../include/class_location.inc");
-    session::set("class_location.inc:timestamp",$tmp['mtime']);
-
                if ($this->iconmenu == ""){
                        $cfg= $this->config->data['MENU'];
 
@@ -413,6 +388,16 @@ class pluglist {
   {
     return(isset($this->allowed_plugins[$plug_id]));
   }
+
+
+  /*! \brief  Force the menu to be recreated 
+   */
+  function reset_menus()
+  {
+    $this->menu = "";
+    $this->iconmenu ="";
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>