roles multiples possible par user, administrables
[mtweb] / mw / env / modules / mw_env_config.php
index 64da6d3..a708431 100644 (file)
@@ -8,6 +8,7 @@
     var $PARAMS;
     var $CONFIG;
     var $bdd;
+    var $actions;
 
     function load_config($bdd, $CONFIG){
       if(true){
           )
         );
       }
+      if(isset($app_config["subs"]["actions"][0]["subs"]["module"])){
+        foreach($app_config["subs"]["actions"][0]["subs"]["module"] as $module_elt){
+          $module_name = $module_elt["attrs"]["name"];
+          if(!isset($this->actions[$module_name])) $this->actions[$module_name] = array(
+            "controleurs" => array(),
+            "module_allowed" => false,
+            "is_public" => false
+          );
+          if(isset($module_elt["subs"]["controleur"])){
+            foreach($module_elt["subs"]["controleur"] as $controleur_elt){
+              $controleur_name = $controleur_elt["attrs"]["name"];
+              if(!isset($this->actions[$module_name]["controleurs"][$controleur_name])) $this->actions[$module_name]["controleurs"][$controleur_name] = array(
+                "als" => array(),
+                "controleur_allowed" => false,
+                "is_public" => false
+              );
+              if(isset($controleur_elt["subs"]["al"])){
+                $al_index = 0;
+                foreach($controleur_elt["subs"]["al"] as $al_elt){
+                  $action_title = $al_elt["attrs"]["title"];
+                  if(isset($al_elt["subs"]["action"])){
+                    foreach($al_elt["subs"]["action"] as $action_elt){
+                      if(!isset($this->actions[$module_name]["controleurs"][$controleur_name]["als"][$al_index])){
+                        $this->actions[$module_name]["controleurs"][$controleur_name]["als"][$al_index] = array(
+                          "title" => $action_title,
+                          "action_allowed" => false,
+                          "is_public" => false,
+                          "actions" => array()
+                        );
+                      }
+                      $this->actions[$module_name]["controleurs"][$controleur_name]["als"][$al_index]["actions"][] = $action_elt["attrs"]["name"];
+                    }
+                  }
+                  $al_index++;
+                }
+              }
+            }
+          }
+        }
+      }
     }
 
     function get_config_file(){
       return false;
     }
 
+    function get_actions(){
+      return isset($this->actions) ? $this->actions : array();
+    }
+
   }
 
 ?>
\ No newline at end of file