|
1
|
{% extends "base.html" %} |
|
2
|
{% block title %}Roles — Fossilrepo{% endblock %} |
|
3
|
|
|
4
|
{% block content %} |
|
5
|
<div class="mb-6"> |
|
6
|
<a href="{% url 'organization:settings' %}" class="text-sm text-brand-light hover:text-brand">← Back to Settings</a> |
|
7
|
</div> |
|
8
|
|
|
9
|
<div class="md:flex md:items-center md:justify-between mb-6"> |
|
10
|
<h1 class="text-2xl font-bold text-gray-100">Roles</h1> |
|
11
|
<div class="mt-4 md:mt-0 flex gap-3"> |
|
12
|
{% if not roles %} |
|
13
|
{% if perms.organization.change_organization or user.is_superuser %} |
|
14
|
<form method="post" action="{% url 'organization:role_initialize' %}"> |
|
15
|
{% csrf_token %} |
|
16
|
<button type="submit" |
|
17
|
class="inline-flex items-center rounded-md bg-gray-700 px-4 py-2 text-sm font-semibold text-gray-100 shadow-sm ring-1 ring-inset ring-gray-600 hover:bg-gray-600"> |
|
18
|
Initialize Roles |
|
19
|
</button> |
|
20
|
</form> |
|
21
|
{% endif %} |
|
22
|
{% endif %} |
|
23
|
{% if perms.organization.change_organization or user.is_superuser %} |
|
24
|
<a href="{% url 'organization:role_create' %}" |
|
25
|
class="inline-flex items-center rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover"> |
|
26
|
Create Role |
|
27
|
</a> |
|
28
|
{% endif %} |
|
29
|
</div> |
|
30
|
</div> |
|
31
|
|
|
32
|
{% if roles %} |
|
33
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2"> |
|
34
|
{% for role in roles %} |
|
35
|
<a href="{% url 'organization:role_detail' slug=role.slug %}" |
|
36
|
class="group block overflow-hidden rounded-lg bg-gray-800 shadow border border-gray-700 hover:border-brand p-5 transition-colors"> |
|
37
|
<div class="flex items-start justify-between"> |
|
38
|
<div> |
|
39
|
<h3 class="text-lg font-semibold text-gray-100 group-hover:text-brand-light">{{ role.name }}</h3> |
|
40
|
<p class="mt-1 text-sm text-gray-400">{{ role.description|default:"No description." }}</p> |
|
41
|
</div> |
|
42
|
{% if role.is_default %} |
|
43
|
<span class="inline-flex rounded-full bg-blue-900/50 px-2 text-xs font-semibold leading-5 text-blue-300">Default</span> |
|
44
|
{% endif %} |
|
45
|
</div> |
|
46
|
<div class="mt-4 flex items-center gap-4 text-sm text-gray-400"> |
|
47
|
<span class="flex items-center gap-1"> |
|
48
|
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> |
|
49
|
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z" /> |
|
50
|
</svg> |
|
51
|
{{ role.permission_count }} permission{{ role.permission_count|pluralize }} |
|
52
|
</span> |
|
53
|
<span class="flex items-center gap-1"> |
|
54
|
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> |
|
55
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-3.07M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z" /> |
|
56
|
</svg> |
|
57
|
{{ role.member_count }} member{{ role.member_count|pluralize }} |
|
58
|
</span> |
|
59
|
</div> |
|
60
|
</a> |
|
61
|
{% endfor %} |
|
62
|
</div> |
|
63
|
{% else %} |
|
64
|
<div class="rounded-lg border border-gray-700 bg-gray-800 px-6 py-12 text-center shadow"> |
|
65
|
<svg class="mx-auto h-12 w-12 text-gray-500" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> |
|
66
|
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z" /> |
|
67
|
</svg> |
|
68
|
<h3 class="mt-2 text-sm font-semibold text-gray-100">No roles defined</h3> |
|
69
|
<p class="mt-1 text-sm text-gray-400">Initialize the default roles to get started with role-based access control.</p> |
|
70
|
</div> |
|
71
|
{% endif %} |
|
72
|
{% endblock %} |
|
73
|
|