update index page
This commit is contained in:
parent
00ed7ef491
commit
cb7afab382
|
|
@ -41,31 +41,6 @@ class UserController extends AbstractController
|
|||
{
|
||||
}
|
||||
|
||||
#[Route('/', name: 'index', methods: ['GET'])]
|
||||
public function index(): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
|
||||
$user = $this->userService->getUserByIdentifier($this->getUser()->getUserIdentifier());
|
||||
|
||||
if ($this->isGranted('ROLE_SUPER_ADMIN')) {
|
||||
$uo = $this->uoRepository->findUsersWithOrganization();
|
||||
$noOrgUsers = $this->userService->formatNoOrgUsersAsAssoc(
|
||||
$this->userRepository->findUsersWithoutOrganization());
|
||||
$usersByOrganization = $this->userService->groupByOrganization($uo);
|
||||
$usersByOrganization += $noOrgUsers;
|
||||
|
||||
//Log action
|
||||
$this->actionService->createAction("View all users", $user, null, "All");
|
||||
|
||||
} else {
|
||||
$usersByOrganization = [];
|
||||
}
|
||||
|
||||
return $this->render('user/index.html.twig', [
|
||||
'usersByOrganization' => $usersByOrganization,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/view/{id}', name: 'show', methods: ['GET'])]
|
||||
public function view(int $id, Request $request): Response
|
||||
|
|
@ -446,8 +421,8 @@ class UserController extends AbstractController
|
|||
]);
|
||||
}
|
||||
|
||||
#[Route(path: '/indexTest', name: 'indexTest', methods: ['GET'])]
|
||||
public function indexTest(): Response
|
||||
#[Route(path: '/', name: 'index', methods: ['GET'])]
|
||||
public function index(): Response
|
||||
{
|
||||
$actingUser = $this->userService->getUserByIdentifier($this->getUser()->getUserIdentifier());
|
||||
if ($this->userService->hasAccessTo($actingUser, true) && $this->isGranted("ROLE_ADMIN")) {
|
||||
|
|
|
|||
|
|
@ -3,35 +3,41 @@
|
|||
{% block title %}User Profile{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="w-100 h-100 p-5 m-auto">
|
||||
{# TODO: check for border-0#}
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h1>Gestion Utilisateurs</h1>
|
||||
{% if is_granted('ROLE_SUPER_ADMIN') %}
|
||||
<a href="{{ path('user_new') }}" class="btn btn-primary">Ajouter un utilisateur</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{#TODO: Remove/Adapt userList depending on design review #}
|
||||
{% if is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN') %}
|
||||
{% if usersByOrganization|length == 0 %}
|
||||
<div class="alert alert-info">
|
||||
<h4>Aucun utilisateur trouvé</h4>
|
||||
{% if is_granted('ROLE_SUPER_ADMIN') %}
|
||||
<div class="w-100 h-100 p-5 m-auto">
|
||||
<div class="card p-3 m-3 border-0">
|
||||
<div class="card-header border-0">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3 ">
|
||||
<h1>Gestion Utilisateurs</h1>
|
||||
<a href="{{ path('user_new') }}" class="btn btn-primary">Ajouter un utilisateur</a>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
{% for org in usersByOrganization %}
|
||||
{% include 'user/userList.html.twig' with {
|
||||
title: org.name,
|
||||
organizationId: org.id|default(null),
|
||||
logo: org.logo|default(null),
|
||||
users: org.users
|
||||
} %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
||||
{% if users|length == 0 %}
|
||||
<div class="alert alert-info">
|
||||
<h4>Aucun utilisateur trouvé</h4>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card border-0">
|
||||
<div class="card-body">
|
||||
<div id="tabulator-userList" data-controller="user"
|
||||
data-user-aws-value="{{ aws_url }}"
|
||||
data-user-list-value="true">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% else %}
|
||||
<div class="w-100 h-100 p-5 m-auto">
|
||||
<div class="alert alert-warning">
|
||||
<h4>Accès limité</h4>
|
||||
<p>Vous n'avez pas les permissions nécessaires pour voir la liste des utilisateurs.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}User Profile{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% if is_granted('ROLE_SUPER_ADMIN') %}
|
||||
<div class="w-100 h-100 p-5 m-auto">
|
||||
<div class="card p-3 m-3 border-0">
|
||||
<div class="card-header border-0">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3 ">
|
||||
<h1>Gestion Utilisateurs</h1>
|
||||
<a href="{{ path('user_new') }}" class="btn btn-primary">Ajouter un utilisateur</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if users|length == 0 %}
|
||||
<div class="alert alert-info">
|
||||
<h4>Aucun utilisateur trouvé</h4>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card border-0">
|
||||
<div class="card-body">
|
||||
<div id="tabulator-userList" data-controller="user"
|
||||
data-user-aws-value="{{ aws_url }}"
|
||||
data-user-list-value="true">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% else %}
|
||||
<div class="w-100 h-100 p-5 m-auto">
|
||||
<div class="alert alert-warning">
|
||||
<h4>Accès limité</h4>
|
||||
<p>Vous n'avez pas les permissions nécessaires pour voir la liste des utilisateurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Loading…
Reference in New Issue