diff options
Diffstat (limited to 'modules-available/systemstatus')
7 files changed, 96 insertions, 9 deletions
diff --git a/modules-available/systemstatus/config.json b/modules-available/systemstatus/config.json index 3c2efce7..cf774d1b 100644 --- a/modules-available/systemstatus/config.json +++ b/modules-available/systemstatus/config.json @@ -1,4 +1,6 @@ { - "category":"main.status", - "dependencies": [ "js_circles" ] -} + "category": "main.status", + "dependencies": [ + "js_circles" + ] +}
\ No newline at end of file diff --git a/modules-available/systemstatus/lang/de/permissions.json b/modules-available/systemstatus/lang/de/permissions.json new file mode 100644 index 00000000..a3041fbc --- /dev/null +++ b/modules-available/systemstatus/lang/de/permissions.json @@ -0,0 +1,13 @@ +{ + "serverreboot": "Server neustarten.", + "show.overview.addresses": "Zeige Adresskonfiguration auf \u00dcbersichtsseite.", + "show.overview.diskstat": "Zeige Speicherplatzwerte auf \u00dcbersichtsseite.", + "show.overview.dmsdusers": "Zeige dmsd-Werte auf \u00dcbersichtsseite.", + "show.overview.services": "Zeige Dienste auf \u00dcbersichtsseite.", + "show.overview.systeminfo": "Zeige Systemwerte auf \u00dcbersichtsseite.", + "tab.dmsdlog": "Zugriff auf bwLehrpool-Suite-Server Statusausgabe.", + "tab.ldadplog": "Zugriff auf LDAP\/AD-Proxy Logs.", + "tab.lighttpdlog": "Zugriff auf Webserver-Logs.", + "tab.netstat": "Zeige Ausgabe von netstat.", + "tab.pslist": "Zeige Prozessliste." +}
\ No newline at end of file diff --git a/modules-available/systemstatus/lang/de/template-tags.json b/modules-available/systemstatus/lang/de/template-tags.json index 89066257..eeb75f9a 100644 --- a/modules-available/systemstatus/lang/de/template-tags.json +++ b/modules-available/systemstatus/lang/de/template-tags.json @@ -26,7 +26,7 @@ "lang_storeMissingExpected": "VM-Store nicht eingebunden. Erwartet:", "lang_storeNotConfigured": "Kein VM-Store konfiguriert!", "lang_swapUsage": "swap-Nutzung", - "lang_swapWarning": "Es wird swap-Speicher genutzt. Dies kann ein Hinweis darauf sein, dass dem Satelliten-Server zu wenig physikalischer Speicher zur Verf\u00fcgung steht. Im Falle von Performance-Problemen oder Instabilit\u00e4t des Servers sollten Sie erw\u00e4gen, den Server mit mehr RAM auszustatten.", + "lang_swapWarning": "Es wird swap-Speicher genutzt. Dies kann ein Hinweis darauf sein, dass dem Satellitenserver zu wenig physikalischer Speicher zur Verf\u00fcgung steht. Im Falle von Performance-Problemen oder Instabilit\u00e4t des Servers sollten Sie erw\u00e4gen, den Server mit mehr RAM auszustatten.", "lang_system": "System", "lang_systemPartition": "Systempartition", "lang_systemStoreError": "Fehler beim Ermitteln des verf\u00fcgbaren Systemspeichers", diff --git a/modules-available/systemstatus/lang/en/permissions.json b/modules-available/systemstatus/lang/en/permissions.json new file mode 100644 index 00000000..879fa882 --- /dev/null +++ b/modules-available/systemstatus/lang/en/permissions.json @@ -0,0 +1,13 @@ +{ + "serverreboot": "Reboot server.", + "show.overview.addresses": "Show addresses on overview page.", + "show.overview.diskstat": "Show diskstats on overview page.", + "show.overview.dmsdusers": "Show dmsd-stats on overview page.", + "show.overview.services": "Show services on overview page.", + "show.overview.systeminfo": "Show systeminfo on overview page.", + "tab.dmsdlog": "Show bwLehrpool-Suite status.", + "tab.ldadplog": "Show LDAP\/AD proxy logs.", + "tab.lighttpdlog": "Show web server logs.", + "tab.netstat": "Show output of netstat.", + "tab.pslist": "Show process list." +}
\ No newline at end of file diff --git a/modules-available/systemstatus/page.inc.php b/modules-available/systemstatus/page.inc.php index 8a0e5f87..04423eaf 100644 --- a/modules-available/systemstatus/page.inc.php +++ b/modules-available/systemstatus/page.inc.php @@ -15,8 +15,10 @@ class Page_SystemStatus extends Page } if (Request::post('action') === 'reboot') { + User::assertPermission("serverreboot"); $this->rebootTask = Taskmanager::submit('Reboot'); } + User::assertPermission('*'); } protected function doRender() @@ -30,9 +32,11 @@ class Page_SystemStatus extends Page foreach ($tabs as $tab) { $data['tabs'][] = array( 'type' => $tab, - 'name' => Dictionary::translate('tab_' . $tab) + 'name' => Dictionary::translate('tab_' . $tab), + 'enabled' => User::hasPermission('tab.' . $tab), ); } + Permission::addGlobalTags($data['perms'], null, ['serverreboot']); Render::addTemplate('_page', $data); } @@ -54,6 +58,7 @@ class Page_SystemStatus extends Page protected function ajaxDmsdUsers() { + User::assertPermission("show.overview.dmsdusers"); $ret = Download::asStringPost('http://127.0.0.1:9080/status/fileserver', false, 2, $code); $args = array(); if ($code != 200) { @@ -75,6 +80,7 @@ class Page_SystemStatus extends Page protected function ajaxDiskStat() { + User::assertPermission("show.overview.diskstat"); $task = Taskmanager::submit('DiskStat'); if ($task === false) return; @@ -136,6 +142,7 @@ class Page_SystemStatus extends Page protected function ajaxAddressList() { + User::assertPermission("show.overview.addresses"); $task = Taskmanager::submit('LocalAddressesList'); if ($task === false) return; @@ -178,6 +185,7 @@ class Page_SystemStatus extends Page protected function ajaxSystemInfo() { + User::assertPermission("show.overview.systeminfo"); $cpuInfo = file_get_contents('/proc/cpuinfo'); $uptime = file_get_contents('/proc/uptime'); $cpuCount = preg_match_all('/\bprocessor\s/', $cpuInfo, $out); @@ -201,7 +209,7 @@ class Page_SystemStatus extends Page $data['swapTotal'] = Util::readableFileSize($info['SwapTotal'] * 1024); $data['swapUsed'] = Util::readableFileSize(($info['SwapTotal'] - $info['SwapFree']) * 1024); $data['swapPercent'] = 100 - round(($info['SwapFree'] / $info['SwapTotal']) * 100); - $data['swapWarning'] = ($data['swapPercent'] > 50 || ($info['SwapTotal'] - $info['SwapFree']) > 200000); + $data['swapWarning'] = ($data['swapPercent'] > 50 || $info['SwapFree'] < 400000); } if (isset($info['CpuIdle']) && isset($info['CpuSystem']) && isset($info['CpuTotal'])) { $data['cpuLoad'] = 100 - round(($info['CpuIdle'] / $info['CpuTotal']) * 100); @@ -215,6 +223,7 @@ class Page_SystemStatus extends Page protected function ajaxSysPoll() { + User::assertPermission("show.overview.systeminfo"); $info = $this->sysInfo(); $data = array( 'CpuTotal' => $info['CpuTotal'], @@ -228,10 +237,11 @@ class Page_SystemStatus extends Page protected function ajaxServices() { + User::assertPermission("show.overview.services"); $data = array('services' => array()); $tasks = array(); - $todo = ['dmsd', 'atftpd']; + $todo = ['dmsd', 'tftpd-hpa']; if (Module::isAvailable('dnbd3') && Dnbd3::isEnabled()) { $todo[] = 'dnbd3-server'; } @@ -275,6 +285,7 @@ class Page_SystemStatus extends Page protected function ajaxDmsdLog() { + User::assertPermission("tab.dmsdlog"); $fh = @fopen('/var/log/dmsd.log', 'r'); if ($fh === false) { echo 'Error opening log file'; @@ -307,6 +318,7 @@ class Page_SystemStatus extends Page protected function ajaxLighttpdLog() { + User::assertPermission("tab.lighttpdlog"); $fh = @fopen('/var/log/lighttpd/error.log', 'r'); if ($fh === false) { echo 'Error opening log file'; @@ -339,6 +351,7 @@ class Page_SystemStatus extends Page protected function ajaxLdadpLog() { + User::assertPermission("tab.ldadplog"); $haveSysconfig = Module::isAvailable('sysconfig'); $files = glob('/var/log/ldadp/*.log', GLOB_NOSORT); if ($files === false || empty($files)) echo('No logs found'); @@ -377,6 +390,7 @@ class Page_SystemStatus extends Page protected function ajaxNetstat() { + User::assertPermission("tab.netstat"); $taskId = Taskmanager::submit('Netstat'); if ($taskId === false) return; @@ -392,6 +406,7 @@ class Page_SystemStatus extends Page protected function ajaxPsList() { + User::assertPermission("tab.pslist"); $taskId = Taskmanager::submit('PsList'); if ($taskId === false) return; diff --git a/modules-available/systemstatus/permissions/permissions.json b/modules-available/systemstatus/permissions/permissions.json new file mode 100644 index 00000000..29e26b5e --- /dev/null +++ b/modules-available/systemstatus/permissions/permissions.json @@ -0,0 +1,35 @@ +{ + "serverreboot": { + "location-aware": false + }, + "tab.dmsdlog": { + "location-aware": false + }, + "tab.netstat": { + "location-aware": false + }, + "tab.pslist": { + "location-aware": false + }, + "tab.ldadplog": { + "location-aware": false + }, + "tab.lighttpdlog": { + "location-aware": false + }, + "show.overview.addresses": { + "location-aware": false + }, + "show.overview.diskstat": { + "location-aware": false + }, + "show.overview.dmsdusers": { + "location-aware": false + }, + "show.overview.services": { + "location-aware": false + }, + "show.overview.systeminfo": { + "location-aware": false + } +}
\ No newline at end of file diff --git a/modules-available/systemstatus/templates/_page.html b/modules-available/systemstatus/templates/_page.html index 0de94cad..64830ea3 100644 --- a/modules-available/systemstatus/templates/_page.html +++ b/modules-available/systemstatus/templates/_page.html @@ -11,11 +11,20 @@ </a> </li> {{#tabs}} + {{^enabled}} + <li class="disabled"> + <a> + {{name}} + </a> + </li> + {{/enabled}} + {{#enabled}} <li> <a href="#id-{{type}}_pane" class="ajax-tab" id="id-{{type}}" data-toggle="tab" role="tab"> {{name}} </a> </li> + {{/enabled}} {{/tabs}} </ul> @@ -83,10 +92,10 @@ {{lang_maintenance}} </div> <div class="panel-body"> - <form class="form-adduser" action="?do=SystemStatus" method="post"> + <form action="?do=SystemStatus" method="post"> <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="action" value="reboot"> - <button class="btn btn-warning" type="button" data-toggle="modal" data-target="#rebootServerModal"><span class="glyphicon glyphicon-repeat"></span> {{lang_serverReboot}}</button> + <button {{perms.serverreboot.disabled}} class="btn btn-warning" type="button" data-toggle="modal" data-target="#rebootServerModal"><span class="glyphicon glyphicon-repeat"></span> {{lang_serverReboot}}</button> <div class ="modal fade" id="rebootServerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |