Example #1
0
 $padre['expanded'] = true;
 $padre['iconCls'] = 'Clsmodule';
 $name = '';
 $name = $m->name();
 //VEO SI EL MODULO ESTA EN EL ROL
 if ($modules_role) {
     if (in_array($name, $modules_role)) {
         $padre['checked'] = true;
     } else {
         $padre['checked'] = false;
     }
 } else {
     $padre['checked'] = false;
 }
 $padre['children'] = array();
 if ($permisos = seguridad_permission::listPermissionsFor($m)) {
     foreach ($permisos as $p) {
         $permiso = array();
         $permiso['leaf'] = false;
         $permiso['expanded'] = true;
         $permiso['id'] = "p_" . $p->get("permission");
         $permiso['text'] = $p->get("nicename");
         $permiso['children'] = array();
         $permiso['iconCls'] = 'Clspermiso';
         if ($acciones = seguridad_action::listActionsFor($p, ALL_MENU)) {
             foreach ($acciones as $a) {
                 $accion = array();
                 $accion['leaf'] = true;
                 $accion['id'] = "a_" . $a->get("action");
                 $accion['text'] = $a->get("nicename");
                 $accion['iconCls'] = 'Clsaccion';
Example #2
0
    throw new OOB_exception("Acceso Denegado", "403", "Acceso Denegado. Consulte con su Administrador!", true);
}
$i = 0;
$modSelect = '';
$arrModulo = array();
$arrIdModulo = array();
if ($objModulo = OOB_module::listModules()) {
    //cargar modulos
    foreach ($objModulo as $m) {
        $modules[$i]['name'] = $m->nicename();
        //nombre
        $modules[$i]['id'] = $m->name();
        //id
        $perm_name = array();
        $perm_id = array();
        if ($objPermiso = seguridad_permission::listPermissionsFor($m, true)) {
            $j = 0;
            //cargar permisos para modulo actual
            foreach ($objPermiso as $p) {
                $perm_name[$j] = $p->get("nicename") . " (" . $p->get("name") . ")";
                $perm_id[$j] = $p->get("permission");
                $j++;
            }
        }
        $refrescados = array();
        //vemos si tenemos q refrescar algo
        if (isset($_POST['modulo']) && isset($_POST['permiso']) && isset($_POST['accion']) && isset($_POST['nicename']) && isset($_POST['inmenu'])) {
            //cargo el array refrescados
            $r = 0;
            for ($k = 0; $k < count($_POST['modulo']); $k++) {
                //me fijo si el elemento posteado actual es del modulo q recorro
Example #3
0
 /** returns the module admin menu */
 public function adminMenu()
 {
     global $ari;
     if ($ari->get('user') == false || is_a($ari->module, 'OOB_module') == false) {
         return false;
     }
     $menu = "";
     $array_menu = array();
     // loads localized array
     @(include $this->admindir() . DIRECTORY_SEPARATOR . 'menu' . DIRECTORY_SEPARATOR . $ari->agent->getLang() . '.php');
     // cache del menu para cada modulo en cada usuario
     // Set a id for this cache
     $id = 'menu__' . $ari->agent->getLang() . '__' . $ari->user->get('user') . '-' . $this->name() . '.php';
     //Set cache options
     $options = array('cacheDir' => $ari->cachedir . DIRECTORY_SEPARATOR, 'lifeTime' => SQL_CACHE, 'fileNameProtection' => false, 'automaticSerialization' => true);
     // Create a Cache_Lite object
     $Cache_Lite = new Cache_Lite($options);
     // Test if thereis a valide cache for this id
     if ($menu = $Cache_Lite->get($id)) {
         return $menu;
     } else {
         // No valid cache found
         if ($permissions = seguridad_permission::listPermissionsFor($this)) {
             $menu = array();
             $i = 0;
             foreach ($permissions as $p) {
                 if ($actions = seguridad_action::listActionsFor($p, IN_MENU)) {
                     foreach ($actions as $a) {
                         if (seguridad::isAllowed($a, $ari->perspective)) {
                             if (!count($array_menu) == 0) {
                                 $menu[$i]['name'] = $array_menu[$p->get("name") . $a->get("name")];
                             } else {
                                 $menu[$i]['name'] = $a->get("nicename");
                             }
                             $menu[$i]['link'] = $this->name() . "/" . $p->get("name") . "/" . $a->get("name");
                             $i++;
                         }
                     }
                     //end foreach $actions
                 }
             }
             //end foreach $permissions
         }
         if (count($menu) == 0) {
             $menu = false;
         }
         $Cache_Lite->save($menu);
         return $menu;
     }
     // end cache
 }