diff options
author | Christian Hofmaier | 2017-11-23 14:30:45 +0100 |
---|---|---|
committer | Christian Hofmaier | 2017-11-23 14:30:45 +0100 |
commit | cc94be665c2a35b2b047e463afa7bfaa5832891e (patch) | |
tree | c9e7de03760b2a9b464fd8d4b097812b0f4cca1f /modules-available/internetaccess | |
parent | Merge remote-tracking branch 'origin/master' into permission-manager (diff) | |
download | slx-admin-cc94be665c2a35b2b047e463afa7bfaa5832891e.tar.gz slx-admin-cc94be665c2a35b2b047e463afa7bfaa5832891e.tar.xz slx-admin-cc94be665c2a35b2b047e463afa7bfaa5832891e.zip |
[internetaccess] reworked permission system from "click and you get error" to "button is disabled due to lack of permission" (this time with double check on permissions)
Diffstat (limited to 'modules-available/internetaccess')
-rw-r--r-- | modules-available/internetaccess/page.inc.php | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/modules-available/internetaccess/page.inc.php b/modules-available/internetaccess/page.inc.php index 89897fa4..a92ba3e3 100644 --- a/modules-available/internetaccess/page.inc.php +++ b/modules-available/internetaccess/page.inc.php @@ -15,23 +15,25 @@ class Page_InternetAccess extends Page $action = Request::any('action', 'show'); if ($action == 'save') { - if (isset($_POST['PROXY_CONF'])) { - $data = array(); - foreach (array('PROXY_CONF', 'PROXY_ADDR', 'PROXY_PORT', 'PROXY_USERNAME', 'PROXY_PASSWORD') as $key) { - $data[$key] = Request::post($key, ''); - } - if (!FileUtil::arrayToFile(CONFIG_PROXY_CONF, $data)) { - Message::addError('main.error-write', CONFIG_PROXY_CONF); - Util::redirect(); - } else { - Message::addSuccess('settings-updated'); - Taskmanager::release(Taskmanager::submit('ReloadProxy')); - $taskids = array(); - Trigger::stopDaemons(NULL, $taskids); - $taskids = array(); - Trigger::startDaemons(NULL, $taskids); - Session::set('ia-restart', $taskids); - Util::redirect('?do=InternetAccess&show=update'); + if (User::hasPermission("configuration.safe")) { + if (isset($_POST['PROXY_CONF'])) { + $data = array(); + foreach (array('PROXY_CONF', 'PROXY_ADDR', 'PROXY_PORT', 'PROXY_USERNAME', 'PROXY_PASSWORD') as $key) { + $data[$key] = Request::post($key, ''); + } + if (!FileUtil::arrayToFile(CONFIG_PROXY_CONF, $data)) { + Message::addError('main.error-write', CONFIG_PROXY_CONF); + Util::redirect(); + } else { + Message::addSuccess('settings-updated'); + Taskmanager::release(Taskmanager::submit('ReloadProxy')); + $taskids = array(); + Trigger::stopDaemons(null, $taskids); + $taskids = array(); + Trigger::startDaemons(null, $taskids); + Session::set('ia-restart', $taskids); + Util::redirect('?do=InternetAccess&show=update'); + } } } } |