diff options
author | Simon Rettberg | 2022-05-21 12:38:16 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-05-21 12:38:16 +0200 |
commit | db1dcf5a9bcd6efa4744c60cfca37a3ee0e4173e (patch) | |
tree | 441737aa92b4f27c8d0e0030bbb3096b98717f39 /modules-available/remoteaccess | |
parent | .idea: Silence annoying inspection (diff) | |
download | slx-admin-db1dcf5a9bcd6efa4744c60cfca37a3ee0e4173e.tar.gz slx-admin-db1dcf5a9bcd6efa4744c60cfca37a3ee0e4173e.tar.xz slx-admin-db1dcf5a9bcd6efa4744c60cfca37a3ee0e4173e.zip |
[remoteaccess] Mark locations that have access restrictions in place
Diffstat (limited to 'modules-available/remoteaccess')
-rw-r--r-- | modules-available/remoteaccess/page.inc.php | 19 | ||||
-rw-r--r-- | modules-available/remoteaccess/templates/edit-group.html | 8 |
2 files changed, 22 insertions, 5 deletions
diff --git a/modules-available/remoteaccess/page.inc.php b/modules-available/remoteaccess/page.inc.php index ca0218e2..70d34238 100644 --- a/modules-available/remoteaccess/page.inc.php +++ b/modules-available/remoteaccess/page.inc.php @@ -29,10 +29,10 @@ class Page_RemoteAccess extends Page Database::exec("UPDATE remoteaccess_group SET groupname = :name, wolcount = :wol, passwd = :passwd, active = :active WHERE groupid = :id", [ 'id' => $id, - 'name' => isset($group['groupname']) ? $group['groupname'] : $id, - 'wol' => isset($group['wolcount']) ? $group['wolcount'] : 0, - 'passwd' => isset($group['passwd']) ? $group['passwd'] : 0, - 'active' => isset($group['active']) && $group['active'] ? 1 : 0, + 'name' => $group['groupname'] ?? $id, + 'wol' => $group['wolcount'] ?? 0, + 'passwd' => $group['passwd'] ?? 0, + 'active' => (int)($group['active'] ?? 0), ]); } Message::addSuccess('settings-saved'); @@ -116,10 +116,19 @@ class Page_RemoteAccess extends Page $locationList[$lid]['checked'] = 'checked'; } } + $scheduler = Module::isAvailable('rebootcontrol'); foreach ($locationList as $lid => &$loc) { if (!in_array($lid, $allowed)) { $loc['disabled'] = 'disabled'; } + if ($scheduler) { + $options = Scheduler::getLocationOptions($lid); + if ($options['ra-mode'] === Scheduler::RA_SELECTIVE) { + $loc['ra_selective'] = true; + } elseif ($options['ra-mode'] === Scheduler::RA_NEVER) { + $loc['ra_never'] = true; + } + } } $data = [ 'groupid' => $groupid, @@ -136,7 +145,7 @@ class Page_RemoteAccess extends Page * @param int $groupid group to check * @return bool if we have permission for all the locations assigned to group */ - private function checkGroupLocations($groupid) + private function checkGroupLocations(int $groupid): bool { $allowed = User::getAllowedLocations('group.locations'); if (in_array(0, $allowed)) diff --git a/modules-available/remoteaccess/templates/edit-group.html b/modules-available/remoteaccess/templates/edit-group.html index 0f09f071..3f456cb7 100644 --- a/modules-available/remoteaccess/templates/edit-group.html +++ b/modules-available/remoteaccess/templates/edit-group.html @@ -33,6 +33,14 @@ <td class="text-nowrap"> <div style="display:inline-block;width:{{depth}}em"></div> <label for="loc-check-{{locationid}}" class="{{disabled}}">{{locationname}}</label> + {{#ra_never}} + – + <span class="glyphicon glyphicon-remove text-danger" title="{{lang_roomRemoteAccessDisabled}}"></span> + {{/ra_never}} + {{#ra_selective}} + – + <span class="glyphicon glyphicon-time" title="{{lang_roomRemoteAccessWhenClosed}}"></span> + {{/ra_selective}} </td> </tr> {{/locations}} |