[dev] [PATCH] menu items without parents

Bernard Blackham b-horde at blackham.com.au
Sat Feb 21 01:36:54 PST 2004


If you specify an application in registry.php without a menu_parent,
the permissions on it are never checked when building the menu. This
patch resolves that issue. Not sure if it's the cleanest method and
caters for all values of $params['status'], but it works for me :)

Bernard.

-- 
 Bernard Blackham <bernard at blackham dot com dot au>
-------------- next part --------------
Index: menu.php
===================================================================
RCS file: /repository/horde/services/portal/menu.php,v
retrieving revision 2.75
diff -u -r2.75 menu.php
--- menu.php	14 Feb 2004 01:36:27 -0000	2.75
+++ menu.php	21 Feb 2004 09:24:13 -0000
@@ -25,24 +25,27 @@
             if (!isset($children[$params['menu_parent']])) {
                 $children[$params['menu_parent']] = array();
             }
+        }
 
-            /* Check if user has permisson to see this application,
-             * and if the application is active. Administrators always
-             * see all applications. Anyone with SHOW permissions can
-             * see an application, but READ is needed to actually use
-             * the application. You can use this distinction to show
-             * applications to guests that they need to log in to
-             * use. If you don't want them to see apps they can't use,
-             * then don't give guests SHOW permissions to anything. */
-            if ((Auth::isAdmin() &&
-                 ($params['status'] == 'active' ||
-                  $params['status'] == 'admin')) ||
-                (($perms->exists($app) ? $perms->hasPermission($app, Auth::getAuth(), PERMS_SHOW) : Auth::getAuth()) &&
-                 $params['status'] == 'active')) {
+        /* Check if user has permisson to see this application,
+         * and if the application is active. Administrators always
+         * see all applications. Anyone with SHOW permissions can
+         * see an application, but READ is needed to actually use
+         * the application. You can use this distinction to show
+         * applications to guests that they need to log in to
+         * use. If you don't want them to see apps they can't use,
+         * then don't give guests SHOW permissions to anything. */
+        if ((Auth::isAdmin() &&
+             ($params['status'] == 'active' ||
+              $params['status'] == 'admin')) ||
+            (($perms->exists($app) ? $perms->hasPermission($app, Auth::getAuth(), PERMS_SHOW) : Auth::getAuth()) &&
+             $params['status'] == 'active')) {
+            if (isset($params['menu_parent'])) {
                 $children[$params['menu_parent']][$app] = $params;
-            } else {
-                $registry->applications[$app]['status'] = 'inactive';
             }
+        } else {
+            if ($params['status'] != 'heading')
+                $registry->applications[$app]['status'] = 'inactive';
         }
     }
 


More information about the dev mailing list