diff options
author | Christian Hofmaier | 2017-11-21 17:28:34 +0100 |
---|---|---|
committer | Christian Hofmaier | 2017-11-21 17:28:34 +0100 |
commit | dfca01bd4444478a9fa5a4f9778ee56b932f0e5c (patch) | |
tree | 2b4335371097901e803d0de6f9d13a446521a20c /modules-available/internetaccess | |
parent | [news] reworked permission system from "click and you get error" to "button i... (diff) | |
download | slx-admin-dfca01bd4444478a9fa5a4f9778ee56b932f0e5c.tar.gz slx-admin-dfca01bd4444478a9fa5a4f9778ee56b932f0e5c.tar.xz slx-admin-dfca01bd4444478a9fa5a4f9778ee56b932f0e5c.zip |
[internetaccess] reworked permission system from "click and you get error" to "button is disabled due to lack of permission"
Diffstat (limited to 'modules-available/internetaccess')
-rw-r--r-- | modules-available/internetaccess/page.inc.php | 42 | ||||
-rw-r--r-- | modules-available/internetaccess/templates/_page.html | 2 |
2 files changed, 21 insertions, 23 deletions
diff --git a/modules-available/internetaccess/page.inc.php b/modules-available/internetaccess/page.inc.php index b1dff722..89897fa4 100644 --- a/modules-available/internetaccess/page.inc.php +++ b/modules-available/internetaccess/page.inc.php @@ -15,29 +15,24 @@ class Page_InternetAccess extends Page $action = Request::any('action', 'show'); if ($action == 'save') { - if (User::hasPermission("configuration.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 (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'); } - } else { - Message::addError('main.no-permission'); - Util::redirect('?do=internetaccess'); } } } @@ -56,6 +51,9 @@ class Page_InternetAccess extends Page if (!isset($data['PROXY_CONF'])) $data['PROXY_CONF'] = 'AUTO'; $data['selected_' . $data['PROXY_CONF']] = 'selected'; + + $data['allowedSave'] = User::hasPermission("configuration.safe"); + Render::addTemplate('_page', $data); } diff --git a/modules-available/internetaccess/templates/_page.html b/modules-available/internetaccess/templates/_page.html index d363561e..1413e280 100644 --- a/modules-available/internetaccess/templates/_page.html +++ b/modules-available/internetaccess/templates/_page.html @@ -33,6 +33,6 @@ </div> <br/> <div class="text-right"> - <button class="btn btn-primary" type="submit"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button> + <button {{^allowedSave}}disabled{{/allowedSave}} class="btn btn-primary" type="submit"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button> </div> </form> |