{% extends "base.html" %}{% block title %}Rôles configurables{% endblock %}{% block content %}<div class="container-fluid"><div class="d-flex justify-content-between align-items-center"><h1>Rôles et permissions</h1><a class="btn btn-outline-primary" href="{{ url_for('admin.permissions') }}">Vue historique</a></div><div class="card my-3"><div class="card-body"><h5>Créer un rôle</h5><form method="post" class="row g-2"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><div class="col-md-3"><input class="form-control" name="name" placeholder="Gestionnaire stock" required></div><div class="col-md-3"><input class="form-control" name="slug" placeholder="gestionnaire_stock" required></div><div class="col-md-4"><input class="form-control" name="description" placeholder="Description"></div><div class="col-md-2"><button class="btn btn-primary w-100">Créer</button></div></form></div></div><table class="table table-hover"><tr><th>Rôle</th><th>Code</th><th>Type</th><th>Utilisateurs</th><th></th></tr>{% for role in roles_list %}<tr><td><strong>{{ role.name }}</strong><br><small>{{ role.description or '' }}</small></td><td><code>{{ role.slug }}</code></td><td>{{ 'Système' if role.is_system else 'Personnalisé' }}</td><td>{{ role.user_links|length }}</td><td><a class="btn btn-sm btn-outline-primary" href="{{ url_for('admin.role_permissions', role_id=role.id) }}">Configurer les droits</a>{% if not role.is_system and role.is_active %}<form class="d-inline" method="post" action="{{ url_for('admin.role_archive', role_id=role.id) }}"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><button class="btn btn-sm btn-outline-danger" onclick="return confirm('Archiver ce rôle ?')">Archiver</button></form>{% endif %}</td></tr>{% else %}<tr><td colspan="5">Aucun rôle RBAC migré.</td></tr>{% endfor %}</table></div>{% endblock %}
