Esempio n. 1
0
 public static function checkModule($module, $controller, $action)
 {
     $arr_action = Access::__getAllowActions($module, $controller);
     if (!empty($arr_action) && in_array($action, $arr_action)) {
         return true;
     }
     $arr_mapp = Access::__getcrudMapping($module, $controller);
     $action = Access::__getMappingAction($arr_mapp, $action);
     if (Access::isLoggedin()) {
         $user_module = Access::__getPermissionCurrentModule($module);
         switch ($action) {
             case "view":
                 if (empty($user_module) || $user_module['perms']['_read'] == DENY_P) {
                     return false;
                 }
                 return true;
             case "edit":
                 if (empty($user_module) || $user_module['perms']['_update'] == DENY_P) {
                     return false;
                 }
                 return true;
             case "delete":
                 if (empty($user_module) || $user_module['perms']['_delete'] == DENY_P) {
                     return false;
                 }
                 return true;
             case "add":
                 if (empty($user_module) || $user_module['perms']['_create'] == DENY_P) {
                     return false;
                 }
                 return true;
             default:
                 return false;
         }
     }
     return true;
 }