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'])]
|
#[Route('/view/{id}', name: 'show', methods: ['GET'])]
|
||||||
public function view(int $id, Request $request): Response
|
public function view(int $id, Request $request): Response
|
||||||
|
|
@ -446,8 +421,8 @@ class UserController extends AbstractController
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route(path: '/indexTest', name: 'indexTest', methods: ['GET'])]
|
#[Route(path: '/', name: 'index', methods: ['GET'])]
|
||||||
public function indexTest(): Response
|
public function index(): Response
|
||||||
{
|
{
|
||||||
$actingUser = $this->userService->getUserByIdentifier($this->getUser()->getUserIdentifier());
|
$actingUser = $this->userService->getUserByIdentifier($this->getUser()->getUserIdentifier());
|
||||||
if ($this->userService->hasAccessTo($actingUser, true) && $this->isGranted("ROLE_ADMIN")) {
|
if ($this->userService->hasAccessTo($actingUser, true) && $this->isGranted("ROLE_ADMIN")) {
|
||||||
|
|
|
||||||
|
|
@ -3,35 +3,41 @@
|
||||||
{% block title %}User Profile{% endblock %}
|
{% block title %}User Profile{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
{% if is_granted('ROLE_SUPER_ADMIN') %}
|
||||||
<div class="w-100 h-100 p-5 m-auto">
|
<div class="w-100 h-100 p-5 m-auto">
|
||||||
{# TODO: check for border-0#}
|
<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 ">
|
<div class="d-flex justify-content-between align-items-center mb-3 ">
|
||||||
<h1>Gestion Utilisateurs</h1>
|
<h1>Gestion Utilisateurs</h1>
|
||||||
{% if is_granted('ROLE_SUPER_ADMIN') %}
|
|
||||||
<a href="{{ path('user_new') }}" class="btn btn-primary">Ajouter un utilisateur</a>
|
<a href="{{ path('user_new') }}" class="btn btn-primary">Ajouter un utilisateur</a>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{#TODO: Remove/Adapt userList depending on design review #}
|
</div>
|
||||||
{% if is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN') %}
|
|
||||||
{% if usersByOrganization|length == 0 %}
|
{% if users|length == 0 %}
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<h4>Aucun utilisateur trouvé</h4>
|
<h4>Aucun utilisateur trouvé</h4>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% for org in usersByOrganization %}
|
<div class="card border-0">
|
||||||
{% include 'user/userList.html.twig' with {
|
<div class="card-body">
|
||||||
title: org.name,
|
<div id="tabulator-userList" data-controller="user"
|
||||||
organizationId: org.id|default(null),
|
data-user-aws-value="{{ aws_url }}"
|
||||||
logo: org.logo|default(null),
|
data-user-list-value="true">
|
||||||
users: org.users
|
</div>
|
||||||
} %}
|
</div>
|
||||||
{% endfor %}
|
</div>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
<div class="w-100 h-100 p-5 m-auto">
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
<h4>Accès limité</h4>
|
<h4>Accès limité</h4>
|
||||||
<p>Vous n'avez pas les permissions nécessaires pour voir la liste des utilisateurs.</p>
|
<p>Vous n'avez pas les permissions nécessaires pour voir la liste des utilisateurs.</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% 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