diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:39:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:39:39 +0000 |
commit | 8ca6cc32b2c789a3149861159ad258f2cb9491e3 (patch) | |
tree | 2492de6f1528dd44eaa169a5c1555026d9cb75ec /application/views/scripts/user | |
parent | Initial commit. (diff) | |
download | icingaweb2-upstream.tar.xz icingaweb2-upstream.zip |
Adding upstream version 2.11.4.upstream/2.11.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/views/scripts/user')
-rw-r--r-- | application/views/scripts/user/form.phtml | 6 | ||||
-rw-r--r-- | application/views/scripts/user/list.phtml | 90 | ||||
-rw-r--r-- | application/views/scripts/user/show.phtml | 138 |
3 files changed, 234 insertions, 0 deletions
diff --git a/application/views/scripts/user/form.phtml b/application/views/scripts/user/form.phtml new file mode 100644 index 0000000..cbf0659 --- /dev/null +++ b/application/views/scripts/user/form.phtml @@ -0,0 +1,6 @@ +<div class="controls"> + <?= $tabs->showOnlyCloseButton(); ?> +</div> +<div class="content"> + <?= $form; ?> +</div>
\ No newline at end of file diff --git a/application/views/scripts/user/list.phtml b/application/views/scripts/user/list.phtml new file mode 100644 index 0000000..bdb5f1a --- /dev/null +++ b/application/views/scripts/user/list.phtml @@ -0,0 +1,90 @@ +<?php + +use Icinga\Data\Extensible; +use Icinga\Data\Reducible; + +if (! $this->compact): ?> +<div class="controls separated"> + <?= $this->tabs ?> + <?= $this->paginator ?> + <div class="sort-controls-container"> + <?= $this->limiter ?> + <?= $this->sortBox ?> + </div> + <?= $this->backendSelection ?> + <?= $this->filterEditor ?> +</div> +<?php endif ?> +<div class="content"> +<?php + +if (! isset($backend)) { + echo $this->translate('No backend found which is able to list users') . '</div>'; + return; +} else { + $extensible = $this->hasPermission('config/access-control/users') && $backend instanceof Extensible; + $reducible = $this->hasPermission('config/access-control/users') && $backend instanceof Reducible; +} +?> + +<?php if ($extensible): ?> + <?= $this->qlink( + $this->translate('Add a New User') , + 'user/add', + array('backend' => $backend->getName()), + array( + 'class' => 'button-link', + 'data-base-target' => '_next', + 'icon' => 'plus' + ) + ) ?> +<?php endif ?> + +<?php if (! $users->hasResult()): ?> + <p><?= $this->translate('No users found matching the filter') ?></p> +</div> +<?php return; endif ?> + + <table data-base-target="_next" class="table-row-selectable common-table"> + <thead> + <tr> + <th><?= $this->translate('Username') ?></th> + <?php if ($reducible): ?> + <th><?= $this->translate('Remove') ?></th> + <?php endif ?> + </tr> + </thead> + <tbody> + <?php foreach ($users as $user): ?> + <tr> + <td><?= $this->qlink( + $user->user_name, + 'user/show', + array( + 'backend' => $backend->getName(), + 'user' => $user->user_name + ), + array( + 'title' => sprintf($this->translate('Show detailed information about %s'), $user->user_name) + ) + ) ?></td> + <?php if ($reducible): ?> + <td class="icon-col"><?= $this->qlink( + null, + 'user/remove', + array( + 'backend' => $backend->getName(), + 'user' => $user->user_name + ), + array( + 'class' => 'action-link', + 'icon' => 'cancel', + 'title' => sprintf($this->translate('Remove user %s'), $user->user_name) + ) + ) ?></td> + <?php endif ?> + </tr> + <?php endforeach ?> + </tbody> + </table> +</div> diff --git a/application/views/scripts/user/show.phtml b/application/views/scripts/user/show.phtml new file mode 100644 index 0000000..b19c15a --- /dev/null +++ b/application/views/scripts/user/show.phtml @@ -0,0 +1,138 @@ +<?php + +use Icinga\Data\Updatable; +use Icinga\Data\Reducible; +use Icinga\Data\Selectable; + +?> +<div class="controls separated"> +<?php if (! $this->compact): ?> + <?= $tabs; ?> +<?php endif ?> + <h2><?= $this->escape($user->user_name) ?></h2> + <?php + if ($this->hasPermission('config/access-control/users') && $backend instanceof Updatable) { + echo $this->qlink( + $this->translate('Edit User'), + 'user/edit', + array( + 'backend' => $backend->getName(), + 'user' => $user->user_name + ), + array( + 'class' => 'button-link', + 'icon' => 'edit', + 'title' => sprintf($this->translate('Edit user %s'), $user->user_name) + ) + ); + } + ?> + <table class="name-value-table"> + <tr> + <th><?= $this->translate('State'); ?></th> + <td><?= $user->is_active === null ? '-' : ($user->is_active ? $this->translate('Active') : $this->translate('Inactive')); ?></td> + </tr> + <tr> + <th><?= $this->translate('Created at'); ?></th> + <td><?= $user->created_at === null ? '-' : $this->formatDateTime($user->created_at); ?></td> + </tr> + <tr> + <th><?= $this->translate('Last modified'); ?></th> + <td><?= $user->last_modified === null ? '-' : $this->formatDateTime($user->last_modified); ?></td> + </tr> + <tr> + <th><?= $this->translate('Role Memberships'); ?></th> + <td> + <?php $roles = $userObj->getRoles(); ?> + <?php if (! empty($roles)): ?> + <ul class="role-memberships"> + <?php foreach($roles as $role): ?> + <li> + <?php if ($this->allowedToEditRoles): ?> + <?= $this->qlink( + $role->getName(), + 'role/edit', + ['role' => $role->getName()], + ['title' => sprintf($this->translate('Edit role %s'), $role->getName())] + ); + $role === end($roles) ? print '' : print ', '; ?> + <?php else: ?> + <?= $role->getName() ?> + <?php endif ?> + </li> + <?php endforeach ?> + </ul> + <?php else: ?> + <p><?= $this->translate('No memberships found'); ?></p> + <?php endif ?> + </td> + </tr> + </table> +<?php if (! $this->compact): ?> + <h2><?= $this->translate('Group Memberships'); ?></h2> + <div class="sort-controls-container"> + <?= $this->limiter; ?> + <?= $this->paginator; ?> + <?= $this->sortBox; ?> + </div> + <?= $this->filterEditor; ?> +<?php endif ?> +</div> +<div class="content"> +<?php if ($showCreateMembershipLink): ?> + <?= $this->qlink( + $this->translate('Create New Membership'), + 'user/createmembership', + array( + 'backend' => $backend->getName(), + 'user' => $user->user_name + ), + array( + 'icon' => 'plus', + 'class' => 'button-link' + ) + ) ?> +<?php endif ?> + +<?php if (! $memberships->hasResult()): ?> + <p><?= $this->translate('No memberships found matching the filter'); ?></p> +</div> +<?php return; endif ?> + + <table data-base-target="_next" class="table-row-selectable common-table"> + <thead> + <tr> + <th><?= $this->translate('Group'); ?></th> + <th><?= $this->translate('Cancel', 'group.membership'); ?></th> + </tr> + </thead> + <tbody> + <?php foreach ($memberships as $membership): ?> + <tr> + <td> + <?php if ($this->hasPermission('config/access-control/groups') && $membership->backend instanceof Selectable): ?> + <?= $this->qlink($membership->group_name, 'group/show', array( + 'backend' => $membership->backend->getName(), + 'group' => $membership->group_name + ), array( + 'title' => sprintf($this->translate('Show detailed information for group %s'), $membership->group_name) + )); ?> + <?php else: ?> + <?= $this->escape($membership->group_name); ?> + <?php endif ?> + </td> + <td class="icon-col" data-base-target="_self"> + <?php if (isset($removeForm) && $membership->backend instanceof Reducible): ?> + <?= $removeForm->setAction($this->url('group/removemember', array( + 'backend' => $membership->backend->getName(), + 'group' => $membership->group_name + ))); ?> + <?php else: ?> + - + <?php endif ?> + </td> + </tr> + <?php endforeach ?> + </tbody> + </table> +</div> |