110 lines
5.4 KiB
HTML
110 lines
5.4 KiB
HTML
# ==============================================================================
|
|
# Formeleon - Multi-tenant Form Generator
|
|
# Author: Björn Runden <br@runden.net>
|
|
# Template: admin/users/list.html
|
|
# Description: List all users with filtering and role management.
|
|
# ============================================================================== #}
|
|
|
|
{% extends "base.html" %}
|
|
|
|
{% block title %}Users - Formeleon{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container">
|
|
<div class="row mb-4">
|
|
<div class="col-12 d-flex justify-content-between align-items-center">
|
|
<h1><i class="bi bi-people"></i> Users</h1>
|
|
</div>
|
|
</div>
|
|
|
|
{% if users %}
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-header bg-light d-flex justify-content-between align-items-center">
|
|
<h5><i class="bi bi-list"></i> All Users ({{ users|length }})</h5>
|
|
<div class="input-group" style="width: 300px;">
|
|
<input type="text" class="form-control" id="searchInput" placeholder="Search users...">
|
|
<button class="btn btn-outline-secondary" type="button">
|
|
<i class="bi bi-search"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Email</th>
|
|
<th>Role</th>
|
|
<th>Tenants</th>
|
|
<th>Last Login</th>
|
|
<th>Created</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for u in users %}
|
|
<tr>
|
|
<td>{{ u.name }}</td>
|
|
<td>{{ u.email }}</td>
|
|
<td>
|
|
<span class="badge bg-{{ 'primary' if u.role.value == 'admin' else 'success' if u.role.value == 'tenant_admin' else 'info' if u.role.value == 'user' else 'secondary' }}">
|
|
{{ u.role.value }}
|
|
</span>
|
|
</td>
|
|
<td>{{ u.tenants|length }}</td>
|
|
<td>{{ u.last_login.strftime('%Y-%m-%d %H:%M') if u.last_login else 'Never' }}</td>
|
|
<td>{{ u.created_at.strftime('%Y-%m-%d') if u.created_at else 'N/A' }}</td>
|
|
<td>
|
|
<div class="btn-group btn-group-sm" role="group">
|
|
<a href="{{ url_for('admin.view_user', user_id=u.id) }}" class="btn btn-outline-secondary" title="View">
|
|
<i class="bi bi-eye"></i>
|
|
</a>
|
|
<a href="{{ url_for('admin.manage_user_tenants', user_id=u.id) }}" class="btn btn-outline-info" title="Manage Tenants">
|
|
<i class="bi bi-buildings"></i>
|
|
</a>
|
|
<form action="{{ url_for('admin.delete_user', user_id=u.id) }}" method="POST"
|
|
onsubmit="return confirm('Are you sure you want to delete user {{ u.email }}? This action cannot be undone.');">
|
|
<button type="submit" class="btn btn-outline-danger" title="Delete">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body text-center py-5">
|
|
<i class="bi bi-people display-4 text-muted mb-3"></i>
|
|
<h3>No Users</h3>
|
|
<p class="text-muted">No users have been registered yet.</p>
|
|
<p class="text-muted">Users are created through OIDC authentication (Zitadel) or in development mode.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if dev_mode %}
|
|
<div class="container mt-4">
|
|
<div class="alert alert-info">
|
|
<i class="bi bi-info-circle"></i> <strong>Development Mode:</strong>
|
|
User management is available. In production, users are managed through your OIDC provider.
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|