From: <abe...@us...> - 2013-05-01 18:56:41
|
Revision: 6069 http://sourceforge.net/p/astlinux/code/6069 Author: abelbeck Date: 2013-05-01 18:56:37 +0000 (Wed, 01 May 2013) Log Message: ----------- web interface, Prefs tab, allow 'staff' user to access SQL-Data tab, disabled by default Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/admin/sqldata.php branches/1.0/package/webinterface/altweb/common/functions.php branches/1.0/package/webinterface/altweb/common/header.php Modified: branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php 2013-04-30 23:49:58 UTC (rev 6068) +++ branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php 2013-05-01 18:56:37 UTC (rev 6069) @@ -33,7 +33,7 @@ //please report any bugs you encounter to http://code.google.com/p/phpliteadmin/issues/list -//AstLinux// Restrict to 'admin' user. +//AstLinux// Restrict to 'admin' or 'staff' user. function getPHPusername() { if (isset($_SERVER['REMOTE_USER'])) { @@ -43,11 +43,12 @@ } return($str_R); } -if (($global_user = getPHPusername()) !== 'admin') { +$global_user = getPHPusername(); +if ($global_user !== 'admin' && $global_user !== 'staff') { echo '<p style="color: red;">User "'.$global_user.'" does not have permission to access the "phpliteadmin" tab.</p>'; exit(); } -//AstLinux// end of restrict to 'admin' user. +//AstLinux// end of restrict to 'admin' or 'staff' user. //BEGIN USER-DEFINED VARIABLES ////////////////////////////// Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2013-04-30 23:49:58 UTC (rev 6068) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2013-05-01 18:56:37 UTC (rev 6069) @@ -398,6 +398,10 @@ $value = 'tab_sqldata_show = yes'; fwrite($fp, $value."\n"); } + if (! isset($_POST['sqldata_disable_staff'])) { + $value = 'tab_sqldata_disable_staff = no'; + fwrite($fp, $value."\n"); + } if (isset($_POST['tab_users'])) { $value = 'tab_users_show = yes'; fwrite($fp, $value."\n"); @@ -1061,6 +1065,9 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'tab_sqldata_show') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="tab_sqldata" name="tab_sqldata"'.$sel.' /></td><td colspan="5">Show SQL-Data Tab'.includeTOPICinfo('sqldata-dialplan').'</td></tr>'); + putHtml('<tr class="dtrow1"><td> </td><td colspan="5">'); + $sel = (getPREFdef($global_prefs, 'tab_sqldata_disable_staff') !== 'no') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="sqldata_disable_staff" name="sqldata_disable_staff"'.$sel.' /> Disable SQL-Data Tab for "staff" user</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'tab_users_show') === 'yes') ? ' checked="checked"' : ''; Modified: branches/1.0/package/webinterface/altweb/admin/sqldata.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/sqldata.php 2013-04-30 23:49:58 UTC (rev 6068) +++ branches/1.0/package/webinterface/altweb/admin/sqldata.php 2013-05-01 18:56:37 UTC (rev 6069) @@ -59,13 +59,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $result = 1; - if (! $global_admin) { + if (! ($global_admin || $global_staff_enable_sqldata)) { $result = 999; } header('Location: '.$myself.'?result='.$result); exit; } else { // Start of HTTP GET -$ACCESS_RIGHTS = 'admin'; +$ACCESS_RIGHTS = $global_staff_enable_sqldata ? 'staff' : 'admin'; require_once '../common/header.php'; putHtml("<center>"); Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2013-04-30 23:49:58 UTC (rev 6068) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2013-05-01 18:56:37 UTC (rev 6069) @@ -875,5 +875,6 @@ $global_staff_disable_voicemail = ($global_user === 'staff' && (getPREFdef($global_prefs, 'tab_voicemail_disable_staff') === 'yes')); $global_staff_disable_monitor = ($global_user === 'staff' && (getPREFdef($global_prefs, 'tab_monitor_disable_staff') === 'yes')); $global_staff_disable_followme = ($global_user === 'staff' && (getPREFdef($global_prefs, 'tab_followme_disable_staff') === 'yes')); +$global_staff_enable_sqldata = ($global_user === 'staff' && (getPREFdef($global_prefs, 'tab_sqldata_disable_staff') === 'no')); $global_staff_disable_staff = ($global_user === 'staff' && (getPREFdef($global_prefs, 'tab_staff_disable_staff') === 'yes')); ?> Modified: branches/1.0/package/webinterface/altweb/common/header.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/header.php 2013-04-30 23:49:58 UTC (rev 6068) +++ branches/1.0/package/webinterface/altweb/common/header.php 2013-05-01 18:56:37 UTC (rev 6069) @@ -212,7 +212,7 @@ if ($global_staff && (getPREFdef($global_prefs, 'tab_actionlist_show') === 'yes')) { putHtml('<li><a href="/admin/actionlist.php"><span>Actionlist</span></a></li>'); } - if ($global_admin && (getPREFdef($global_prefs, 'tab_sqldata_show') === 'yes')) { + if (($global_admin || $global_staff_enable_sqldata) && (getPREFdef($global_prefs, 'tab_sqldata_show') === 'yes')) { putHtml('<li><a href="/admin/sqldata.php"><span>SQL-Data</span></a></li>'); } if ($global_staff && (getPREFdef($global_prefs, 'tab_users_show') === 'yes')) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |