aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Strohm <strohm@data-quest.de>2021-08-04 14:41:55 +0000
committerMoritz Strohm <strohm@data-quest.de>2021-08-04 14:41:55 +0000
commit03ee4140273fbc08016980b2abf279559cb4e440 (patch)
treef0b438755f497ede7ac33ac39d2a511dc63f889a
parent165caf7c5314edf10c72c1ed44f2db9298d7453e (diff)
Tic 11: Raumverwaltung: Berechtigungsübersicht soll eine Liste mit Personen anzeigen, die Berechtigungen haben
-rw-r--r--app/controllers/resources/admin.php26
-rw-r--r--app/views/resources/admin/user_permissions.php34
2 files changed, 56 insertions, 4 deletions
diff --git a/app/controllers/resources/admin.php b/app/controllers/resources/admin.php
index 7639ed0..4f413be 100644
--- a/app/controllers/resources/admin.php
+++ b/app/controllers/resources/admin.php
@@ -196,6 +196,32 @@ class Resources_AdminController extends AuthenticatedController
$last_activity_date = $this->now->sub($this->last_activity);
$this->last_activity_date = $last_activity_date->format('d.m.Y H:i');
}
+ } else {
+ //No user selected. Show a list of all users that have
+ //at least one permission in the room management system.
+ if ($user_id) {
+ //User-ID specified, but no user could be found.
+ PageLayout::postError(
+ _('Die angegebene Person wurde nicht gefunden!')
+ );
+ }
+
+ $this->users = User::findBySql(
+ '`user_id` IN (
+ SELECT `user_id`
+ FROM `resource_permissions`
+ UNION
+ SELECT `user_id`
+ FROM `resource_temporary_permissions`
+ )
+ ORDER BY `nachname` ASC, `vorname` ASC'
+ );
+ if (!$this->users) {
+ //No user found.
+ PageLayout::postInfo(
+ _('Es gibt keine Personen, zu denen Berechtigungen in der Raumverwaltung eingetragen sind!')
+ );
+ }
}
}
diff --git a/app/views/resources/admin/user_permissions.php b/app/views/resources/admin/user_permissions.php
index 9035b95..23378a5 100644
--- a/app/views/resources/admin/user_permissions.php
+++ b/app/views/resources/admin/user_permissions.php
@@ -206,8 +206,34 @@
</tbody>
</table>
<? endif ?>
-<? else: ?>
- <?= MessageBox::info(
- _('Es wurde keine Person ausgewählt!')
- ) ?>
+<? elseif ($users) : ?>
+ <table class="default sortable-table" data-sortlist="[[0, 0]]">
+ <caption>
+ <?= _('Personen mit Berechtigungen an der Raumverwaltung') ?>
+ </caption>
+ <thead>
+ <tr>
+ <th data-sort="text"><?= _('Nachname, Vorname') ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <? foreach ($users as $user) : ?>
+ <tr>
+ <td>
+ <a href="<?= $controller->link_for(
+ 'resources/admin/user_permissions',
+ ['user_id' => $user->id]
+ ) ?>">
+ <?= htmlReady($user->getFullName('full_rev')) ?>
+ <?= Icon::create('link-intern')->asImg(
+ [
+ 'class' => 'text-bottom'
+ ]
+ ) ?>
+ </a>
+ </td>
+ </tr>
+ <? endforeach ?>
+ </tbody>
+ </table>
<? endif ?>