From 7e2509c6afbaf2a89d8df747c8e9ad0f48172221 Mon Sep 17 00:00:00 2001 From: Steffen Ritter Date: Tue, 6 Feb 2018 16:16:20 +0100 Subject: [locationinfo] Fix styling of tooltip btns also made the style of two close btns consistent to the rest --- modules-available/locationinfo/style.css | 10 ++++ .../templates/ajax-config-location.html | 14 +++--- .../locationinfo/templates/ajax-config-server.html | 10 ++-- .../templates/page-config-panel-default.html | 54 +++++++++++----------- .../templates/page-config-panel-summary.html | 14 +++--- .../templates/page-config-panel-url.html | 18 ++++---- .../locationinfo/templates/page-locations.html | 4 +- .../locationinfo/templates/page-servers.html | 2 +- .../locationinfo/templates/server-prop-bool.html | 6 +-- .../templates/server-prop-dropdown.html | 6 +-- .../templates/server-prop-generic.html | 6 +-- 11 files changed, 78 insertions(+), 66 deletions(-) create mode 100644 modules-available/locationinfo/style.css (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/style.css b/modules-available/locationinfo/style.css new file mode 100644 index 00000000..b5fffe75 --- /dev/null +++ b/modules-available/locationinfo/style.css @@ -0,0 +1,10 @@ +.btn-static { + background-color: white; + border: 1px solid lightgrey; + cursor: default; +} +.btn-static:active{ + -moz-box-shadow: inset 0 0 0px white; + -webkit-box-shadow: inset 0 0 0px white; + box-shadow: inset 0 0 0px white; +} diff --git a/modules-available/locationinfo/templates/ajax-config-location.html b/modules-available/locationinfo/templates/ajax-config-location.html index b42ff98d..102a6ea4 100644 --- a/modules-available/locationinfo/templates/ajax-config-location.html +++ b/modules-available/locationinfo/templates/ajax-config-location.html @@ -110,9 +110,9 @@
- +

- +

@@ -124,9 +124,9 @@
- +

- +

@@ -137,9 +137,9 @@
- +

- +

@@ -170,7 +170,7 @@ setTimepicker($('#settings-outer').find('.timepicker2')); - $('a.helptext').tooltip(); + $('p.helptext').tooltip(); $('#new-openingtime').click(function (e) { e.preventDefault(); diff --git a/modules-available/locationinfo/templates/ajax-config-server.html b/modules-available/locationinfo/templates/ajax-config-server.html index 940bc55a..8c2cb3ba 100644 --- a/modules-available/locationinfo/templates/ajax-config-server.html +++ b/modules-available/locationinfo/templates/ajax-config-server.html @@ -12,9 +12,9 @@ form="form-{{currentbackend}}">
- +

- +

@@ -34,9 +34,9 @@
- +

- +

@@ -92,7 +92,7 @@ currentBackend = value; } - $('a.btn[title]').tooltip(); + $('p.btn[title]').tooltip(); $('#myModalSubmitButton').attr('form', 'form-' + currentBackend); $('.settings-bs-switch').bootstrapSwitch({size:'small'}); diff --git a/modules-available/locationinfo/templates/page-config-panel-default.html b/modules-available/locationinfo/templates/page-config-panel-default.html index b55e3d4d..41a8fd00 100644 --- a/modules-available/locationinfo/templates/page-config-panel-default.html +++ b/modules-available/locationinfo/templates/page-config-panel-default.html @@ -28,9 +28,9 @@
- +

- +

@@ -48,9 +48,9 @@
- +

- +

@@ -69,9 +69,9 @@
- +

- +

@@ -85,9 +85,9 @@
- +

- +

@@ -101,9 +101,9 @@
- +

- +

@@ -128,9 +128,9 @@ max="1440" value="{{calupdate}}" required>
- +

- +

@@ -145,9 +145,9 @@ max="86400" value="{{roomupdate}}" required>
- +

- +

@@ -177,9 +177,9 @@
- +

- +

@@ -193,9 +193,9 @@
- +

- +

@@ -217,9 +217,9 @@
- +

- +

@@ -238,9 +238,9 @@
- +

- +

@@ -255,9 +255,9 @@
- +

- +

@@ -272,9 +272,9 @@
- +

- +

@@ -338,7 +338,7 @@ document.addEventListener("DOMContentLoaded", function () { var $locInput = $('#locationids'); // Initialize fancy tooltips - $('a.helptext').tooltip(); + $('p.helptext').tooltip(); // Add listener to range sliders so their label can be updated $('input[type="range"]').change(function () { $(this).siblings().find('.range-display').text($(this).val()); diff --git a/modules-available/locationinfo/templates/page-config-panel-summary.html b/modules-available/locationinfo/templates/page-config-panel-summary.html index 2a968fc2..3dc93680 100644 --- a/modules-available/locationinfo/templates/page-config-panel-summary.html +++ b/modules-available/locationinfo/templates/page-config-panel-summary.html @@ -28,9 +28,9 @@
- +

- +

@@ -48,9 +48,9 @@
- +

- +

@@ -64,9 +64,9 @@
- +

- +

@@ -151,7 +151,7 @@ document.addEventListener("DOMContentLoaded", function () { var $locInput = $('#locationids'); // Initialize fancy tooltips - $('a.helptext').tooltip(); + $('p.helptext').tooltip(); // Add listener to range sliders so their label can be updated $('input[type="range"]').change(function () { $(this).siblings().find('.range-display').text($(this).val()); diff --git a/modules-available/locationinfo/templates/page-config-panel-url.html b/modules-available/locationinfo/templates/page-config-panel-url.html index cca81509..798ff55d 100644 --- a/modules-available/locationinfo/templates/page-config-panel-url.html +++ b/modules-available/locationinfo/templates/page-config-panel-url.html @@ -25,9 +25,9 @@
- +

- +

@@ -42,9 +42,9 @@ placeholder="http://www.bwlehrpool.de/" pattern=".*://.*" required>
- +

- +

@@ -61,9 +61,9 @@
- +

- +

@@ -77,9 +77,9 @@
- +

- +

@@ -95,6 +95,8 @@ \ No newline at end of file +//--> diff --git a/modules-available/locationinfo/templates/page-servers.html b/modules-available/locationinfo/templates/page-servers.html index eefb1ed5..dbf18b5f 100644 --- a/modules-available/locationinfo/templates/page-servers.html +++ b/modules-available/locationinfo/templates/page-servers.html @@ -60,7 +60,7 @@ diff --git a/modules-available/locationinfo/templates/server-prop-bool.html b/modules-available/locationinfo/templates/server-prop-bool.html index f430d02c..bd9dcc64 100644 --- a/modules-available/locationinfo/templates/server-prop-bool.html +++ b/modules-available/locationinfo/templates/server-prop-bool.html @@ -7,10 +7,10 @@
{{#helptext}} - +

- +

{{/helptext}}
- \ No newline at end of file + diff --git a/modules-available/locationinfo/templates/server-prop-dropdown.html b/modules-available/locationinfo/templates/server-prop-dropdown.html index 80667766..d1351551 100644 --- a/modules-available/locationinfo/templates/server-prop-dropdown.html +++ b/modules-available/locationinfo/templates/server-prop-dropdown.html @@ -10,10 +10,10 @@
{{#helptext}} - +

- +

{{/helptext}}
- \ No newline at end of file + diff --git a/modules-available/locationinfo/templates/server-prop-generic.html b/modules-available/locationinfo/templates/server-prop-generic.html index 9e94c23d..23ff1e4e 100644 --- a/modules-available/locationinfo/templates/server-prop-generic.html +++ b/modules-available/locationinfo/templates/server-prop-generic.html @@ -7,10 +7,10 @@
{{#helptext}} - +

- +

{{/helptext}}
- \ No newline at end of file + -- cgit v1.2.3-55-g7522 From 841ad3b5849756a4205225d18716abaabc36b568 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sun, 4 Mar 2018 16:43:27 +0100 Subject: [locationinfo] Add permission entry to runmode config --- modules-available/locationinfo/hooks/runmode/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/hooks/runmode/config.json b/modules-available/locationinfo/hooks/runmode/config.json index 4dd7282f..4bba0b5f 100644 --- a/modules-available/locationinfo/hooks/runmode/config.json +++ b/modules-available/locationinfo/hooks/runmode/config.json @@ -3,5 +3,6 @@ "isClient": false, "configHook": "LocationInfo::configHook", "noSysconfig": true, - "systemdDefaultTarget": "kiosk-mode" + "systemdDefaultTarget": "kiosk-mode", + "permission": ".locationinfo.panel.assign-client" } \ No newline at end of file -- cgit v1.2.3-55-g7522 From da8870e85f59dc8e83d2c4f50432f688080cb1d1 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 5 Mar 2018 14:17:36 +0100 Subject: [locationinfo] Add permissions --- .../locationinfo/inc/splittime.php.txt | 80 +++++++++++++ modules-available/locationinfo/page.inc.php | 128 +++++++++++++++++---- .../locationinfo/permissions/permissions.json | 20 ++++ .../locationinfo/templates/page-locations.html | 4 + .../locationinfo/templates/page-panels.html | 8 +- .../locationinfo/templates/page-servers.html | 9 +- .../locationinfo/templates/page-tabs.html | 6 +- 7 files changed, 221 insertions(+), 34 deletions(-) create mode 100644 modules-available/locationinfo/inc/splittime.php.txt create mode 100644 modules-available/locationinfo/permissions/permissions.json (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/inc/splittime.php.txt b/modules-available/locationinfo/inc/splittime.php.txt new file mode 100644 index 00000000..53510fee --- /dev/null +++ b/modules-available/locationinfo/inc/splittime.php.txt @@ -0,0 +1,80 @@ +(Unfinished) + + /* + error_log('Pre calendar: ' . print_r($calendar, true)); + $bad = array(); + for ($i = 0; $i < count($calendar); ++$i) { // Use for..count as we append while iterating + $entry =& $calendar[$i]; + // YYYY-MM-DDHH:MM:SS + $s = explode('T', $entry['start']); + $e = explode('T', $entry['end']); + if (count($s) !== 2 || count($e) !== 2) { + error_log('Ignoring invalid calendar entry from backend ' . $this->serverId . ': ' . json_encode($entry)); + $bad[] = $i; + continue; + } + if ($e[0] === $s[0]) // Same day + continue; + $stime = explode(':', $s[1]); + $etime = explode(':', $e[1]); + if (count($stime) < 2 || count($etime) < 2) { + error_log('Ignoring invalid calendar entry from backend ' . $this->serverId . ': ' . json_encode($entry)); + $bad[] = $i; + continue; + } + // Fix start + if ($stime[0] == 23 && $stime[1] >= 30) { + // clamp to next day + $day = strtotime($s[0] . ' 12:00 +1 day'); + if ($day === false || $day <= 0) { + error_log('Ignoring invalid calendar entry from backend ' . $this->serverId . ': ' . json_encode($entry)); + $bad[] = $i; + continue; + } + $day = date('Y-m-d', $day); + $bad[] = $i; + $calendar[] = array( + 'title' => $entry['title'], + 'start' => $day . 'T00:00:01', + 'end' => $entry['end'] + ); + continue; + } + + // Fix end + if ($etime[0] == 0 && $etime[1] <= 30) { + // clamp to next day + $day = strtotime($e[0] . ' 12:00 -1 day'); + if ($day === false || $day <= 0) { + error_log('Ignoring invalid calendar entry from backend ' . $this->serverId . ': ' . json_encode($entry)); + $bad[] = $i; + continue; + } + $day = date('Y-m-d', $day); + $bad[] = $i; + $calendar[] = array( + 'title' => $entry['title'], + 'start' => $day . 'T23:59:59', + 'end' => $entry['end'] + ); + continue; + } + // Split + $nextday = strtotime($s[0] . ' 12:00 +1 day'); + $nextday = date('Y-m-d', $nextday); + $calendar[] = array( + 'title' => $entry['title'], + 'start' => $nextday . 'T00:00:01', + 'end' => $entry['end'] + ); + $entry['end'] = $s[0] . 'T23:59:59'; + } + unset($entry); + if (!empty($bad)) { + foreach ($bad as $i) { + unset($calendar[$i]); + } + $calendar = array_values($calendar); + } + */ + error_log('Post calendar: ' . print_r($calendar, true)); \ No newline at end of file diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index 777b84db..690012ea 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -2,16 +2,15 @@ class Page_LocationInfo extends Page { - - private $action; + private $show; /** * Called before any page rendering happens - early hook to check parameters etc. */ protected function doPreprocess() { - $show = Request::any('show', '', 'string'); - if ($show === 'panel') { + $this->show = Request::any('show', false, 'string'); + if ($this->show === 'panel') { $this->showPanel(); exit(0); } @@ -20,30 +19,39 @@ class Page_LocationInfo extends Page Message::addError('main.no-permission'); Util::redirect('?do=Main'); // does not return } - $this->action = Request::post('action'); - if ($this->action === 'writePanelConfig') { + $action = Request::post('action'); + if ($action === 'writePanelConfig') { $this->writePanelConfig(); - } elseif ($this->action === 'writeLocationConfig') { + } elseif ($action === 'writeLocationConfig') { $this->writeLocationConfig(); $show = 'locations'; - } elseif ($this->action === 'deleteServer') { + } elseif ($action === 'deleteServer') { $this->deleteServer(); - } elseif ($this->action === 'deletePanel') { + } elseif ($action === 'deletePanel') { $this->deletePanel(); - } elseif ($this->action === 'checkConnection') { + } elseif ($action === 'checkConnection') { $this->checkConnection(Request::post('serverid', 0, 'int')); $show = 'backends'; - } elseif ($this->action === 'updateServerSettings') { + } elseif ($action === 'updateServerSettings') { $this->updateServerSettings(); $show = 'backends'; } elseif (Request::isPost()) { - Message::addWarning('main.invalid-action', $this->action); + Message::addWarning('main.invalid-action', $action); } - if (Request::isPost()) { + if (Request::isPost() || $this->show === false) { if (!empty($show)) { - $show = '&show=' . $show; + // + } elseif (User::hasPermission('panel.list')) { + $show = 'panels'; + } elseif (User::hasPermission('location.*')) { + $show = 'locations'; + } elseif (User::hasPermission('backend.*')) { + $show = 'backends'; + } else { + Message::addError('main.no-permission'); + Util::redirect('?do=main'); } - Util::redirect('?do=locationinfo' . $show); + Util::redirect('?do=locationinfo&show=' . $show); } } @@ -53,10 +61,13 @@ class Page_LocationInfo extends Page protected function doRender() { // Do this here so we always see backend errors - $backends = $this->loadBackends(); - $show = Request::get('show', '', 'string'); - Render::addTemplate('page-tabs', array('class-' . $show => 'active')); - switch ($show) { + if (User::hasPermission('backend.*')) { + $backends = $this->loadBackends(); + } + $data = array('class-' . $this->show => 'active'); + Permission::addGlobalTags($data['perms'], null, ['backend.*', 'location.*', 'panel.list']); + Render::addTemplate('page-tabs', $data); + switch ($this->show) { case 'locations': $this->showLocationsTable(); break; @@ -66,7 +77,7 @@ class Page_LocationInfo extends Page case 'edit-panel': $this->showPanelConfig(); break; - case '': + case 'panels': $this->showPanelsTable(); break; default: @@ -79,6 +90,7 @@ class Page_LocationInfo extends Page */ private function deleteServer() { + User::assertPermission('backend.edit'); $id = Request::post('serverid', false, 'int'); if ($id === false) { Message::addError('server-id-missing'); @@ -97,6 +109,7 @@ class Page_LocationInfo extends Page Message::addError('main.parameter-missing', 'uuid'); return; } + $this->assertPanelPermission($id, 'panel.edit'); $res = Database::exec("DELETE FROM `locationinfo_panel` WHERE paneluuid = :id", array('id' => $id)); if ($res !== 1) { Message::addWarning('invalid-panel-id', $id); @@ -123,6 +136,8 @@ class Page_LocationInfo extends Page Message::addError('location.invalid-location-id', $locationid); return false; } + User::assertPermission('location.edit', $locationid); + $serverid = Request::post('serverid', 0, 'int'); if ($serverid === 0) { $serverid = null; @@ -304,6 +319,8 @@ class Page_LocationInfo extends Page Util::redirect('?do=locationinfo'); } + // Permission + $this->assertPanelPermission($paneluuid, 'panel.edit', $params['locationids']); if ($paneluuid === 'new') { $paneluuid = Util::randomUuid(); @@ -379,6 +396,7 @@ class Page_LocationInfo extends Page */ private function updateServerSettings() { + User::assertPermission('backend.edit'); $serverid = Request::post('id', -1, 'int'); $servername = Request::post('name', 'unnamed', 'string'); $servertype = Request::post('type', '', 'string'); @@ -423,6 +441,7 @@ class Page_LocationInfo extends Page if ($serverid === 0) { Util::traceError('checkConnection called with no server id'); } + User::assertPermission('backend.check'); $dbresult = Database::queryFirst("SELECT servertype, credentials FROM `locationinfo_coursebackend` @@ -482,14 +501,22 @@ class Page_LocationInfo extends Page */ private function showBackendsTable($serverlist) { - // Pass the data to the html and render it. - Render::addTemplate('page-servers', array( + User::assertPermission('backend.*'); + $data = array( 'serverlist' => $serverlist, - )); + ); + Permission::addGlobalTags($data['perms'], null, ['backend.edit', 'backend.check']); + // Pass the data to the html and render it. + Render::addTemplate('page-servers', $data); } private function showLocationsTable() { + $allowedLocations = User::getAllowedLocations('location.edit'); + if (empty($allowedLocations)) { + Message::addError('main.no-permission'); + return; + } $locations = Location::getLocations(0, 0, false, true); // Get hidden state of all locations @@ -499,7 +526,7 @@ class Page_LocationInfo extends Page while ($row = $dbquery->fetch(PDO::FETCH_ASSOC)) { $locid = (int)$row['locationid']; - if (!isset($locations[$locid])) + if (!isset($locations[$locid]) || !in_array($locid, $allowedLocations)) continue; $glyph = !empty($row['openingtime']) ? 'ok' : ''; $backend = ''; @@ -517,6 +544,7 @@ class Page_LocationInfo extends Page $stack = array(); $depth = -1; foreach ($locations as &$location) { + $location['allowed'] = in_array($location['locationid'], $allowedLocations); while ($location['depth'] <= $depth) { array_pop($stack); $depth--; @@ -537,6 +565,13 @@ class Page_LocationInfo extends Page private function showPanelsTable() { + $visibleLocations = User::getAllowedLocations('panel.list'); + $editLocations = User::getAllowedLocations('panel.edit'); + $assignLocations = USer::getAllowedLocations('panel.assign-client'); + if (empty($visibleLocations)) { + Message::addError('main.no-permission'); + return; + } $res = Database::simpleQuery('SELECT p.paneluuid, p.panelname, p.locationids, p.panelconfig, p.paneltype FROM locationinfo_panel p ORDER BY panelname ASC'); @@ -550,8 +585,17 @@ class Page_LocationInfo extends Page if ($row['paneltype'] === 'URL') { $url = json_decode($row['panelconfig'], true)['url']; $row['locations'] = $row['locationurl'] = $url; + $row['edit_disabled'] = empty($editLocations) ? 'disabled' : ''; + $row['runmode_disabled'] = empty($assignLocations) ? 'disabled' : ''; } else { $lids = explode(',', $row['locationids']); + // Permissions + if (!empty(array_diff($lids, $visibleLocations))) { + continue; + } + $row['edit_disabled'] = !empty(array_diff($lids, $editLocations)) ? 'disabled' : ''; + $row['runmode_disabled'] = !empty(array_diff($lids, $assignLocations)) ? 'disabled' : ''; + // Locations $locs = array_map(function ($id) use ($locations) { return isset($locations[$id]) ? $locations[$id]['locationname'] : $id; }, $lids); @@ -594,6 +638,7 @@ class Page_LocationInfo extends Page */ private function ajaxServerSettings($id) { + User::assertPermission('backend.edit'); $oldConfig = Database::queryFirst('SELECT servername, servertype, credentials FROM `locationinfo_coursebackend` WHERE serverid = :id', array('id' => $id)); @@ -641,6 +686,7 @@ class Page_LocationInfo extends Page */ private function ajaxConfigLocation($id) { + User::assertPermission('location.edit', $id); $locConfig = Database::queryFirst("SELECT serverid, serverlocationid, openingtime FROM `locationinfo_locationconfig` WHERE locationid = :id", array('id' => $id)); if ($locConfig !== false) { $openingtimes = json_decode($locConfig['openingtime'], true); @@ -845,6 +891,9 @@ class Page_LocationInfo extends Page $config = json_decode($panel['panelconfig'], true); } + // Permission + $this->assertPanelPermission($panel, 'panel.edit'); + $def = LocationInfo::defaultPanelConfig($panel['paneltype']); if (!is_array($config)) { $config = $def; @@ -953,4 +1002,35 @@ class Page_LocationInfo extends Page die('Unknown panel type ' . $type); } + /** + * @param string|array $panelOrUuid UUID of panel, or array with keys paneltype and locationds + * @param string $permission + * @param null|int[] $additionalLocations + */ + private function assertPanelPermission($panelOrUuid, $permission, $additionalLocations = null) + { + if (is_array($panelOrUuid)) { + $panel = $panelOrUuid; + } else { + $panel = Database::queryFirst('SELECT paneltype, locationids FROM locationinfo_panel + WHERE paneluuid = :uuid', ['uuid' => $panelOrUuid]); + } + if ($panel === false || $panel['paneltype'] === 'URL' || empty($panel['locationids'])) { + if (empty($additionalLocations)) { + User::assertPermission($permission, null, '?do=locationinfo'); + } + } + $allowed = User::getAllowedLocations($permission); + if (!empty($allowed)) { + $locations = explode(',', $panel['locationids']); + if (!empty($additionalLocations)) { + $locations = array_merge($locations, $additionalLocations); + } + if (empty(array_diff($locations, $allowed))) + return; + } + Message::addError('main.no-permission'); + Util::redirect('?do=locationinfo'); + } + } diff --git a/modules-available/locationinfo/permissions/permissions.json b/modules-available/locationinfo/permissions/permissions.json new file mode 100644 index 00000000..be95a7bd --- /dev/null +++ b/modules-available/locationinfo/permissions/permissions.json @@ -0,0 +1,20 @@ +{ + "backend.edit": { + "location-aware": false + }, + "backend.check": { + "location-aware": false + }, + "location.edit": { + "location-aware": true + }, + "panel.list": { + "location-aware": true + }, + "panel.edit": { + "location-aware": true + }, + "panel.assign-client": { + "location-aware": true + } +} \ No newline at end of file diff --git a/modules-available/locationinfo/templates/page-locations.html b/modules-available/locationinfo/templates/page-locations.html index 37d8dd96..94c4cd40 100644 --- a/modules-available/locationinfo/templates/page-locations.html +++ b/modules-available/locationinfo/templates/page-locations.html @@ -17,10 +17,14 @@
+ {{#allowed}} + {{/allowed}} {{locationname}} + {{#allowed}} + {{/allowed}} {{backend}} diff --git a/modules-available/locationinfo/templates/page-panels.html b/modules-available/locationinfo/templates/page-panels.html index e17b6584..2bccc796 100644 --- a/modules-available/locationinfo/templates/page-panels.html +++ b/modules-available/locationinfo/templates/page-panels.html @@ -34,19 +34,21 @@ {{#hasRunmode}} - + {{assignedMachineCount}} {{/hasRunmode}} - + - diff --git a/modules-available/locationinfo/templates/page-servers.html b/modules-available/locationinfo/templates/page-servers.html index dbf18b5f..3edb0e66 100644 --- a/modules-available/locationinfo/templates/page-servers.html +++ b/modules-available/locationinfo/templates/page-servers.html @@ -22,18 +22,19 @@ - - diff --git a/modules-available/locationinfo/templates/page-tabs.html b/modules-available/locationinfo/templates/page-tabs.html index ed3f01fd..743297e7 100644 --- a/modules-available/locationinfo/templates/page-tabs.html +++ b/modules-available/locationinfo/templates/page-tabs.html @@ -1,6 +1,6 @@
\ No newline at end of file -- cgit v1.2.3-55-g7522 From 662315be2b5f6153fda03e8ec48ea3f8b343f68b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 21 Mar 2018 11:05:25 +0100 Subject: Update permission translations --- modules-available/adduser/lang/de/permissions.json | 6 ++++++ modules-available/adduser/lang/en/permissions.json | 6 ++++++ modules-available/baseconfig/lang/de/permissions.json | 4 ++++ modules-available/baseconfig/lang/en/permissions.json | 4 ++++ modules-available/dnbd3/lang/de/permissions.json | 8 ++++++++ modules-available/dnbd3/lang/en/permissions.json | 8 ++++++++ modules-available/locationinfo/lang/de/permissions.json | 8 ++++++++ modules-available/locationinfo/lang/en/permissions.json | 8 ++++++++ modules-available/runmode/lang/de/permissions.json | 3 +++ modules-available/runmode/lang/en/permissions.json | 3 +++ .../serversetup-bwlp/lang/de/permissions.json | 6 +++--- modules-available/statistics/lang/de/permissions.json | 15 +++++++++++---- modules-available/statistics/lang/en/permissions.json | 15 +++++++++++---- modules-available/sysconfig/lang/de/permissions.json | 8 ++++++++ modules-available/sysconfig/lang/en/permissions.json | 8 ++++++++ modules-available/systemstatus/lang/de/permissions.json | 2 +- 16 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 modules-available/adduser/lang/de/permissions.json create mode 100644 modules-available/adduser/lang/en/permissions.json create mode 100644 modules-available/baseconfig/lang/de/permissions.json create mode 100644 modules-available/baseconfig/lang/en/permissions.json create mode 100644 modules-available/dnbd3/lang/de/permissions.json create mode 100644 modules-available/dnbd3/lang/en/permissions.json create mode 100644 modules-available/locationinfo/lang/de/permissions.json create mode 100644 modules-available/locationinfo/lang/en/permissions.json create mode 100644 modules-available/runmode/lang/de/permissions.json create mode 100644 modules-available/runmode/lang/en/permissions.json create mode 100644 modules-available/sysconfig/lang/de/permissions.json create mode 100644 modules-available/sysconfig/lang/en/permissions.json (limited to 'modules-available/locationinfo') diff --git a/modules-available/adduser/lang/de/permissions.json b/modules-available/adduser/lang/de/permissions.json new file mode 100644 index 00000000..636b73ff --- /dev/null +++ b/modules-available/adduser/lang/de/permissions.json @@ -0,0 +1,6 @@ +{ + "list.view": "Nutzerliste anzeigen", + "user.add": "Neuen Nutzer hinzuf\u00fcgen", + "user.edit": "Nutzer bearbeiten", + "user.remove": "Nutzer l\u00f6schen" +} \ No newline at end of file diff --git a/modules-available/adduser/lang/en/permissions.json b/modules-available/adduser/lang/en/permissions.json new file mode 100644 index 00000000..d12d100e --- /dev/null +++ b/modules-available/adduser/lang/en/permissions.json @@ -0,0 +1,6 @@ +{ + "list.view": "Show userlist", + "user.add": "Add new user", + "user.edit": "Edit user", + "user.remove": "Remove user" +} \ No newline at end of file diff --git a/modules-available/baseconfig/lang/de/permissions.json b/modules-available/baseconfig/lang/de/permissions.json new file mode 100644 index 00000000..a010cebe --- /dev/null +++ b/modules-available/baseconfig/lang/de/permissions.json @@ -0,0 +1,4 @@ +{ + "edit": "Konfigurationsvariablen bearbeiten", + "view": "Konfigurationsvariablen anzeigen" +} \ No newline at end of file diff --git a/modules-available/baseconfig/lang/en/permissions.json b/modules-available/baseconfig/lang/en/permissions.json new file mode 100644 index 00000000..9fe69752 --- /dev/null +++ b/modules-available/baseconfig/lang/en/permissions.json @@ -0,0 +1,4 @@ +{ + "edit": "Edit config variables", + "view": "Show config variables" +} \ No newline at end of file diff --git a/modules-available/dnbd3/lang/de/permissions.json b/modules-available/dnbd3/lang/de/permissions.json new file mode 100644 index 00000000..9229d6d9 --- /dev/null +++ b/modules-available/dnbd3/lang/de/permissions.json @@ -0,0 +1,8 @@ +{ + "configure.external": "Externen Proxy bearbeiten", + "configure.proxy": "Automatischen Proxy bearbeiten", + "refresh": "Serverliste aktualisieren", + "toggle-usage": "Aktivieren\/Deaktivieren", + "view.details": "Proxydetails anzeigen", + "view.list": "Proxyliste anzeigen" +} \ No newline at end of file diff --git a/modules-available/dnbd3/lang/en/permissions.json b/modules-available/dnbd3/lang/en/permissions.json new file mode 100644 index 00000000..0762af2c --- /dev/null +++ b/modules-available/dnbd3/lang/en/permissions.json @@ -0,0 +1,8 @@ +{ + "configure.external": "Edit external proxy", + "configure.proxy": "Edit automatic proxy", + "refresh": "Refresh server list", + "toggle-usage": "Activate\/Deactivate", + "view.details": "Show proxy details", + "view.list": "Show proxy list" +} \ No newline at end of file diff --git a/modules-available/locationinfo/lang/de/permissions.json b/modules-available/locationinfo/lang/de/permissions.json new file mode 100644 index 00000000..1cd78eab --- /dev/null +++ b/modules-available/locationinfo/lang/de/permissions.json @@ -0,0 +1,8 @@ +{ + "backend.check": "Backend Verbindung pr\u00fcfen", + "backend.edit": "Backend bearbeiten", + "location.edit": "Raum\/Ort Einstellungen bearbeiten", + "panel.assign-client": "Client als Infoscreen festlegen", + "panel.edit": "Panel bearbeiten", + "panel.list": "Panel anzeigen" +} \ No newline at end of file diff --git a/modules-available/locationinfo/lang/en/permissions.json b/modules-available/locationinfo/lang/en/permissions.json new file mode 100644 index 00000000..4b620b04 --- /dev/null +++ b/modules-available/locationinfo/lang/en/permissions.json @@ -0,0 +1,8 @@ +{ + "backend.check": "Test backend connection", + "backend.edit": "Edit backend", + "location.edit": "Edit location settings", + "panel.assign-client": "Set client as infoscreen", + "panel.edit": "Edit panel", + "panel.list": "List panels" +} \ No newline at end of file diff --git a/modules-available/runmode/lang/de/permissions.json b/modules-available/runmode/lang/de/permissions.json new file mode 100644 index 00000000..0a89e027 --- /dev/null +++ b/modules-available/runmode/lang/de/permissions.json @@ -0,0 +1,3 @@ +{ + "list-all": "Betriebsmodi anzeigen" +} \ No newline at end of file diff --git a/modules-available/runmode/lang/en/permissions.json b/modules-available/runmode/lang/en/permissions.json new file mode 100644 index 00000000..8b3a6e62 --- /dev/null +++ b/modules-available/runmode/lang/en/permissions.json @@ -0,0 +1,3 @@ +{ + "list-all": "Show runmodes" +} \ No newline at end of file diff --git a/modules-available/serversetup-bwlp/lang/de/permissions.json b/modules-available/serversetup-bwlp/lang/de/permissions.json index 673bf153..65367c51 100644 --- a/modules-available/serversetup-bwlp/lang/de/permissions.json +++ b/modules-available/serversetup-bwlp/lang/de/permissions.json @@ -1,5 +1,5 @@ { - "edit.address": "Boot-Adresse des Servers auswählen.", - "edit.menu": "Bootmenü anpassen.", - "download": "USB-Image herunteladen." + "download": "USB-Image herunterladen.", + "edit.address": "Boot-Adresse des Servers ausw\u00e4hlen.", + "edit.menu": "Bootmen\u00fc anpassen." } \ No newline at end of file diff --git a/modules-available/statistics/lang/de/permissions.json b/modules-available/statistics/lang/de/permissions.json index 7b7db89a..8579b28f 100644 --- a/modules-available/statistics/lang/de/permissions.json +++ b/modules-available/statistics/lang/de/permissions.json @@ -1,5 +1,12 @@ { - "view": "Statistiken anschauen.", - "machine.note": "Anmerkungen zu einem Rechner speichern.", - "machine.delete": "Rechner löschen." -} + "hardware.projectors.edit": "Beamerzuweisung bearbeiten", + "hardware.projectors.view": "Beamerzuweisung anzeigen", + "machine.delete": "Rechner l\u00f6schen.", + "machine.note": "Anmerkungen zu einem Rechner speichern.", + "machine.note.edit": "Anmerkungen bearbeiten", + "machine.note.view": "Anmerkungen anzeigen", + "machine.view-details": "Clientinformationen anzeigen", + "view": "Statistiken anschauen.", + "view.list": "Clientliste anzeigen", + "view.summary": "Visualisierung anzeigen" +} \ No newline at end of file diff --git a/modules-available/statistics/lang/en/permissions.json b/modules-available/statistics/lang/en/permissions.json index 01acdb8a..445f96b8 100644 --- a/modules-available/statistics/lang/en/permissions.json +++ b/modules-available/statistics/lang/en/permissions.json @@ -1,5 +1,12 @@ { - "view": "View statistics.", - "machine.note": "Save client notes.", - "machine.delete": "Delete clients." -} + "hardware.projectors.edit": "Edit beamer assignment", + "hardware.projectors.view": "Show beamer assignment", + "machine.delete": "Delete clients.", + "machine.note": "Save client notes.", + "machine.note.edit": "Edit notes", + "machine.note.view": "Show notes", + "machine.view-details": "Show client details", + "view": "View statistics.", + "view.list": "Show client list", + "view.summary": "Show visualization" +} \ No newline at end of file diff --git a/modules-available/sysconfig/lang/de/permissions.json b/modules-available/sysconfig/lang/de/permissions.json new file mode 100644 index 00000000..c32c488b --- /dev/null +++ b/modules-available/sysconfig/lang/de/permissions.json @@ -0,0 +1,8 @@ +{ + "config.assign": "Systemkonfiguration zuweisen", + "config.edit": "Systemkonfiguration bearbeiten", + "config.view-list": "Systemkonfigurationen anzeigen", + "module.download": "Konfigurationsmodul herunterladen", + "module.edit": "Konfigurationsmodul bearbeiten", + "module.view-list": "Konfigurationsmodule anzeigen" +} \ No newline at end of file diff --git a/modules-available/sysconfig/lang/en/permissions.json b/modules-available/sysconfig/lang/en/permissions.json new file mode 100644 index 00000000..14757383 --- /dev/null +++ b/modules-available/sysconfig/lang/en/permissions.json @@ -0,0 +1,8 @@ +{ + "config.assign": "Assign system configuration", + "config.edit": "Edit system configuration", + "config.view-list": "Show system configurations", + "module.download": "Download configuration module", + "module.edit": "Edit configuration module", + "module.view-list": "Show configuration modules" +} \ No newline at end of file diff --git a/modules-available/systemstatus/lang/de/permissions.json b/modules-available/systemstatus/lang/de/permissions.json index 5508beb5..a3041fbc 100644 --- a/modules-available/systemstatus/lang/de/permissions.json +++ b/modules-available/systemstatus/lang/de/permissions.json @@ -8,6 +8,6 @@ "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 Aufgabe von netstat.", + "tab.netstat": "Zeige Ausgabe von netstat.", "tab.pslist": "Zeige Prozessliste." } \ No newline at end of file -- cgit v1.2.3-55-g7522 From 038edd6c903cba29e6ee8ec6a66be057734eea29 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 29 Mar 2018 15:24:16 +0200 Subject: [locationinfo] Fix permission checking: Add missing return statement --- modules-available/locationinfo/page.inc.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index 690012ea..5ef7a9ed 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -1018,6 +1018,7 @@ class Page_LocationInfo extends Page if ($panel === false || $panel['paneltype'] === 'URL' || empty($panel['locationids'])) { if (empty($additionalLocations)) { User::assertPermission($permission, null, '?do=locationinfo'); + return; } } $allowed = User::getAllowedLocations($permission); -- cgit v1.2.3-55-g7522 From 5f43ee22ee0841ce3d237ed52e1b8be0b5af5210 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 29 Mar 2018 17:34:53 +0200 Subject: [locationinfo] Properly check permissions when saving new panel --- modules-available/locationinfo/page.inc.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index 5ef7a9ed..656c2f81 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -1022,8 +1022,14 @@ class Page_LocationInfo extends Page } } $allowed = User::getAllowedLocations($permission); + if (in_array(0, $allowed)) + return; if (!empty($allowed)) { - $locations = explode(',', $panel['locationids']); + if (isset($panel['locationids'])) { + $locations = explode(',', $panel['locationids']); + } else { + $locations = []; + } if (!empty($additionalLocations)) { $locations = array_merge($locations, $additionalLocations); } -- cgit v1.2.3-55-g7522 From 18b55faafc5ad6a2f6656382b151a52f0d2cd48d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 3 Apr 2018 10:49:29 +0200 Subject: [locationinfo] Use User::assertPermission() --- modules-available/locationinfo/page.inc.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index 656c2f81..e1e47385 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -48,8 +48,7 @@ class Page_LocationInfo extends Page } elseif (User::hasPermission('backend.*')) { $show = 'backends'; } else { - Message::addError('main.no-permission'); - Util::redirect('?do=main'); + User::assertPermission('panel.list'); } Util::redirect('?do=locationinfo&show=' . $show); } -- cgit v1.2.3-55-g7522 From 4f18dd73342b91fa2550b3de3d54c89041a5b2c5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 3 Apr 2018 14:13:50 +0200 Subject: [locationinfo] Delete according runmode entries when a panel gets deleted --- modules-available/locationinfo/page.inc.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index e1e47385..93d36de6 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -113,6 +113,7 @@ class Page_LocationInfo extends Page if ($res !== 1) { Message::addWarning('invalid-panel-id', $id); } + RunMode::deleteMode(Page::getModule(), $id); } private function getTime($str) -- cgit v1.2.3-55-g7522 From 0b12472b6ecb09b5053c50bca9e8f13e4f367af3 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 5 Apr 2018 10:12:48 +0200 Subject: [locationinfo] Fix color of seat counter not updating properly --- modules-available/locationinfo/frontend/frontendscript.js | 2 +- modules-available/locationinfo/templates/frontend-default.html | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/frontend/frontendscript.js b/modules-available/locationinfo/frontend/frontendscript.js index bad6a8ed..b5f59792 100644 --- a/modules-available/locationinfo/frontend/frontendscript.js +++ b/modules-available/locationinfo/frontend/frontendscript.js @@ -42,7 +42,7 @@ function toInt(str) { * computes the time difference between 2 Date objects * @param {Date} a * @param {Date} b - * @param {Array} globalConfig + * @param {Object} globalConfig * @returns {string} printable time */ function GetTimeDiferenceAsString(a, b, globalConfig) { diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html index e457f68d..006d2661 100755 --- a/modules-available/locationinfo/templates/frontend-default.html +++ b/modules-available/locationinfo/templates/frontend-default.html @@ -369,7 +369,6 @@ optional: -