feat: gestion des utilisateurs, rôles et équipes
- Ajout de la section de gestion des utilisateurs avec rôles (Admin, Trésorerie, Agent de Saisie). - Restriction des accès par rôle (Admin a tout, Trésorerie a adhérents/paiements, Agent de saisie a adhérents/planning). - Flux de modification obligatoire de mot de passe temporaire au premier login (par défaut AsTalange123). - Intégration de la configuration des équipes du club.
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Ajouter un Utilisateur - AS Talange</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body { font-family: 'Inter', sans-serif; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-50 text-gray-900 flex h-screen overflow-hidden">
|
||||
|
||||
<!-- Sidebar -->
|
||||
<div th:replace="~{fragments/sidebar :: sidebar}"></div>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="flex-1 flex flex-col h-screen overflow-hidden">
|
||||
<!-- Header -->
|
||||
<header class="h-16 bg-white border-b border-gray-200 flex items-center justify-between px-6">
|
||||
<h2 class="text-lg font-semibold text-gray-800">Ajouter un Utilisateur</h2>
|
||||
<a href="/utilisateurs" class="text-sm font-medium text-gray-600 hover:text-gray-900">
|
||||
← Retour à la liste
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<!-- Main section -->
|
||||
<div class="flex-1 overflow-auto p-6 bg-gray-50/50 flex justify-center items-start">
|
||||
|
||||
<div class="w-full max-w-lg bg-white rounded-xl shadow-sm border border-gray-100 p-8 mt-4">
|
||||
<div th:if="${error}" class="bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg mb-6 text-sm">
|
||||
<span th:text="${error}"></span>
|
||||
</div>
|
||||
|
||||
<form th:action="@{/utilisateurs/ajouter}" method="post" class="space-y-6">
|
||||
<div>
|
||||
<label for="username" class="block text-sm font-medium text-gray-700 mb-1">Nom d'utilisateur</label>
|
||||
<input type="text" id="username" name="username" th:value="${username}" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors" required placeholder="Ex: JeanDupont" autofocus>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="roleId" class="block text-sm font-medium text-gray-700 mb-1">Rôle</label>
|
||||
<select id="roleId" name="roleId" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors bg-white" required>
|
||||
<option value="">Sélectionnez un rôle</option>
|
||||
<option th:each="r : ${roles}" th:value="${r.id}"
|
||||
th:text="${r.name == 'ROLE_ADMIN' ? 'Administrateur' : (r.name == 'ROLE_TRESORERIE' ? 'Trésorerie' : (r.name == 'ROLE_AGENT_SAISIE' ? 'Agent de Saisie' : r.name))}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="password" class="block text-sm font-medium text-gray-700 mb-1">Mot de passe temporaire</label>
|
||||
<input type="text" id="password" name="password" th:value="${defaultPassword}" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors" required>
|
||||
<p class="text-xs text-gray-400 mt-1">Le mot de passe par défaut est AsTalange123. L'utilisateur devra le modifier lors de sa première connexion.</p>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-4 rounded-lg transition-colors duration-200">
|
||||
Créer l'utilisateur
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Gestion des Utilisateurs - AS Talange</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body { font-family: 'Inter', sans-serif; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-50 text-gray-900 flex h-screen overflow-hidden">
|
||||
|
||||
<!-- Sidebar -->
|
||||
<div th:replace="~{fragments/sidebar :: sidebar}"></div>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="flex-1 flex flex-col h-screen overflow-hidden">
|
||||
<!-- Header -->
|
||||
<header class="h-16 bg-white border-b border-gray-200 flex items-center justify-between px-6">
|
||||
<h2 class="text-lg font-semibold text-gray-800">Gestion des Utilisateurs</h2>
|
||||
<a href="/utilisateurs/ajouter" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition-colors text-sm">
|
||||
Ajouter un utilisateur
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<!-- Main section -->
|
||||
<div class="flex-1 overflow-auto p-6 bg-gray-50/50">
|
||||
|
||||
<!-- Success / Error messages -->
|
||||
<div th:if="${success}" class="bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg mb-6 text-sm">
|
||||
<span th:text="${success}"></span>
|
||||
</div>
|
||||
<div th:if="${error}" class="bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg mb-6 text-sm">
|
||||
<span th:text="${error}"></span>
|
||||
</div>
|
||||
|
||||
<!-- Users Table -->
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
||||
<table class="w-full text-left border-collapse">
|
||||
<thead>
|
||||
<tr class="bg-gray-50/50 text-gray-500 text-xs uppercase tracking-wider border-b border-gray-100">
|
||||
<th class="py-3 px-6 font-medium">Nom d'utilisateur</th>
|
||||
<th class="py-3 px-6 font-medium">Rôle</th>
|
||||
<th class="py-3 px-6 font-medium">Statut</th>
|
||||
<th class="py-3 px-6 font-medium text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100 text-sm">
|
||||
<tr th:each="user : ${users}" class="hover:bg-gray-50 transition-colors">
|
||||
<td class="py-4 px-6 font-medium text-gray-900" th:text="${user.username}">
|
||||
Ucef
|
||||
</td>
|
||||
<td class="py-4 px-6 text-gray-600">
|
||||
<span th:each="role : ${user.roles}"
|
||||
th:text="${role.name == 'ROLE_ADMIN' ? 'Administrateur' : (role.name == 'ROLE_TRESORERIE' ? 'Trésorerie' : (role.name == 'ROLE_AGENT_SAISIE' ? 'Agent de Saisie' : role.name))}"
|
||||
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 mr-1">
|
||||
Admin
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-4 px-6">
|
||||
<span th:if="${user.mustChangePassword}" class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
|
||||
Mot de passe temporaire
|
||||
</span>
|
||||
<span th:unless="${user.mustChangePassword}" class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
||||
Actif
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-4 px-6 text-right">
|
||||
<!-- Don't show delete button for the current user -->
|
||||
<form th:if="${#authentication.name != user.username}"
|
||||
th:action="@{/utilisateurs/{id}/delete(id=${user.id})}"
|
||||
method="post"
|
||||
class="inline"
|
||||
onsubmit="return confirm('Êtes-vous sûr de vouloir supprimer cet utilisateur ?');">
|
||||
<button type="submit" class="text-red-600 hover:text-red-800 font-medium">
|
||||
Supprimer
|
||||
</button>
|
||||
</form>
|
||||
<span th:if="${#authentication.name == user.username}" class="text-gray-400 italic text-xs">
|
||||
Connecté
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user