Skip to content

Commit

Permalink
feat: add member + user overview table
Browse files Browse the repository at this point in the history
Contains all information from members (and their associated users) for debugging
purposes.
  • Loading branch information
tomudding committed Sep 11, 2024
1 parent abeeb8c commit 1a7115e
Show file tree
Hide file tree
Showing 12 changed files with 260 additions and 20 deletions.
27 changes: 24 additions & 3 deletions module/Application/language/en.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 23 additions & 2 deletions module/Application/language/gewisweb.pot

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 24 additions & 3 deletions module/Application/language/nl.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions module/Application/view/partial/admin.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,21 @@ use Laminas\View\Renderer\PhpRenderer;
<?= $this->translate('Approvals') ?>
</a>
</li>
<?php
endif; ?>
<?php
if ($this->acl('company_service_acl')->isAllowed('jobCategory', 'listAll')): ?>
<?php endif; ?>
<?php if ($this->acl('company_service_acl')->isAllowed('jobCategory', 'listAll')): ?>
<li>
<a href="<?= $this->url('company_admin/categories') ?>">
<?= $this->translate('Categories') ?>
</a>
</li>
<?php
endif; ?>
<?php
if ($this->acl('company_service_acl')->isAllowed('jobLabel', 'listAll')): ?>
<?php endif; ?>
<?php if ($this->acl('company_service_acl')->isAllowed('jobLabel', 'listAll')): ?>
<li>
<a href="<?= $this->url('company_admin/labels') ?>">
<?= $this->translate('Labels') ?>
</a>
</li>
<?php
endif; ?>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
Expand Down Expand Up @@ -179,8 +174,7 @@ use Laminas\View\Renderer\PhpRenderer;
<li class="<?= $this->moduleIsActive(['frontpage', 'news']) ? 'active' : '' ?>">
<a href="<?= $this->url('admin_news') ?>"><?= $this->translate('News') ?></a>
</li>
<?php
endif; ?>
<?php endif; ?>
<?php if ($this->acl('frontpage_service_acl')->isAllowed('page', 'create')): ?>
<li class="<?= $this->moduleIsActive(['frontpage', 'page']) ? 'active' : '' ?>">
<a href="<?= $this->url('admin_page') ?>"><?= $this->translate('Pages') ?></a>
Expand Down Expand Up @@ -210,6 +204,13 @@ use Laminas\View\Renderer\PhpRenderer;
</a>
</li>
<?php endif; ?>
<?php if ($this->acl('user_service_acl')->isAllowed('user', 'view_status')): ?>
<li>
<a href="<?= $this->url('user_admin/members') ?>">
<?= $this->translate('Members') ?>
</a>
</li>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
Expand Down
27 changes: 27 additions & 0 deletions module/Decision/src/Mapper/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use Decision\Model\OrganMember as OrganMemberModel;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use User\Model\User as UserModel;
use User\Model\UserRole as UserRoleModel;

use function strtolower;

Expand Down Expand Up @@ -173,6 +175,31 @@ public function findHistoricalInstallations(MemberModel $member): array
return $qb->getQuery()->getResult();
}

/**
* Fetch all members including their associated user.
*
* NOTE: The ordering of the return array is not as you might expect. The actual result will be like:
*
* array{
* 0: MemberModel,
* 1: ?UserModel,
* 2: MemberModel,
* 3: ... (repeat pattern)
* }
*
* In other words, every 2 rows represent a single `Member`.
*
* @return array<array-key, MemberModel|UserModel|UserRoleModel|null>
*/
public function findAllWithUserDetails(): array
{
$qb = $this->getRepository()->createQueryBuilder('m');
$qb->leftJoin(UserModel::class, 'u', 'WITH', 'm.lidnr = u.lidnr')
->addSelect('u');

return $qb->getQuery()->getResult();
}

protected function getRepositoryName(): string
{
return MemberModel::class;
Expand Down
13 changes: 13 additions & 0 deletions module/User/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
use User\Controller\ApiAuthenticationController;
use User\Controller\Factory\ApiAdminControllerFactory;
use User\Controller\Factory\ApiAuthenticationControllerFactory;
use User\Controller\Factory\UserAdminControllerFactory;
use User\Controller\Factory\UserControllerFactory;
use User\Controller\UserAdminController;
use User\Controller\UserController;

return [
Expand Down Expand Up @@ -155,6 +157,16 @@
],
],
],
'members' => [
'type' => Literal::class,
'options' => [
'route' => '/members',
'defaults' => [
'controller' => UserAdminController::class,
'action' => 'index',
],
],
],
],
'priority' => 100,
],
Expand All @@ -175,6 +187,7 @@
'factories' => [
ApiAdminController::class => ApiAdminControllerFactory::class,
ApiAuthenticationController::class => ApiAuthenticationControllerFactory::class,
UserAdminController::class => UserAdminControllerFactory::class,
UserController::class => UserControllerFactory::class,
],
],
Expand Down
Loading

0 comments on commit 1a7115e

Please sign in to comment.