diff --git a/app/controllers/resources/admin.php b/app/controllers/resources/admin.php index 7639ed02c03640322a7d16948537d801f87d17c6..4f413be98f415cfd72aa6ea16ba337d5650e5b7d 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 9035b9518fcabe6f7707fd537c95df9d214bcd77..23378a5c42cf92309662a91221e79ff335f6c477 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 ?>