From f29117399b13880679e80ceda429ef66198c1465 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 3 Dec 2007 01:46:04 +0000 Subject: Do not set allowed_groups variables. Auth.inc is not alaways available on console scripts but they do not need session auth. --- etc/inc/pfsense-utils.inc | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'etc') diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 265dbca..0b4c466 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -33,12 +33,6 @@ * */ - -if(!$groupindex) - $groupindex = index_groups(); -if(!$userindex) - $userindex = index_users(); - /****f* pfsense-utils/does_url_exist * NAME * does_url_exist @@ -2151,17 +2145,20 @@ function get_disk_info() { function display_top_tabs(& $tab_array) { global $HTTP_SERVER_VARS; global $config; + global $allowed; $auth_user = $HTTP_SERVER_VARS['AUTH_USER']; $groupindex = index_groups(); $userindex = index_users(); - $allowed = array (); - $allowed[] = ''; - if (!isSystemAdmin($HTTP_SERVER_VARS['AUTH_USER'])) - if (isset($config['system']['group'][$groupindex[$config['system']['user'][$userindex[$auth_user]]['groupname']]]['pages'])) - $allowed = &$config['system']['group'][$groupindex[$config['system']['user'][$userindex[$auth_user]]['groupname']]]['pages']; + if(!$allowed) { + $allowed = array (); + $allowed[] = ''; + if (isset($config['system']['group'][$groupindex[$config['system']['user'][$userindex[$HTTP_SERVER_VARS['AUTH_USER']]]['groupname']]]['pages'])) { + $allowed = &$config['system']['group'][$groupindex[$config['system']['user'][$userindex[$HTTP_SERVER_VARS['AUTH_USER']]]['groupname']]]['pages']; + } + } /* does the user have access to this tab? * master user has access to everything. @@ -2185,6 +2182,8 @@ function display_top_tabs(& $tab_array) { $pos_qmark = strpos($link, "?"); $link = substr($link, 0, $pos_qmark); } + $authorized_text = print_r($allowed, true); + log_error("comparing " . basename($link) . " {$authorized_text}"); if (in_array(basename($link), $authorized)) $tab_temp[] = $ta; } -- cgit v1.1