|
1
|
{% extends "base.html" %} |
|
2
|
{% block title %}{{ role.name }} Role — Fossilrepo{% endblock %} |
|
3
|
|
|
4
|
{% block content %} |
|
5
|
<div class="mb-6"> |
|
6
|
<a href="{% url 'organization:role_list' %}" class="text-sm text-brand-light hover:text-brand">← Back to Roles</a> |
|
7
|
</div> |
|
8
|
|
|
9
|
<div class="overflow-hidden rounded-lg bg-gray-800 shadow border border-gray-700"> |
|
10
|
<div class="px-6 py-5 sm:flex sm:items-center sm:justify-between"> |
|
11
|
<div> |
|
12
|
<h1 class="text-2xl font-bold text-gray-100">{{ role.name }}</h1> |
|
13
|
<p class="mt-1 text-sm text-gray-400">{{ role.description|default:"No description." }}</p> |
|
14
|
</div> |
|
15
|
<div class="mt-4 flex items-center gap-3 sm:mt-0"> |
|
16
|
{% if role.is_default %} |
|
17
|
<span class="inline-flex rounded-full bg-blue-900/50 px-2 text-xs font-semibold leading-5 text-blue-300">Default Role</span> |
|
18
|
{% endif %} |
|
19
|
{% if perms.organization.change_organization or user.is_superuser %} |
|
20
|
<a href="{% url 'organization:role_edit' slug=role.slug %}" |
|
21
|
class="rounded-md bg-gray-700 px-3 py-2 text-sm font-semibold text-gray-100 shadow-sm ring-1 ring-inset ring-gray-600 hover:bg-gray-600"> |
|
22
|
Edit |
|
23
|
</a> |
|
24
|
<a href="{% url 'organization:role_delete' slug=role.slug %}" |
|
25
|
class="rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500"> |
|
26
|
Delete |
|
27
|
</a> |
|
28
|
{% endif %} |
|
29
|
</div> |
|
30
|
</div> |
|
31
|
|
|
32
|
<div class="border-t border-gray-700 px-6 py-5"> |
|
33
|
<dl class="grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-2"> |
|
34
|
<div> |
|
35
|
<dt class="text-sm font-medium text-gray-400">Slug</dt> |
|
36
|
<dd class="mt-1 text-sm text-gray-400 font-mono">{{ role.slug }}</dd> |
|
37
|
</div> |
|
38
|
<div> |
|
39
|
<dt class="text-sm font-medium text-gray-400">GUID</dt> |
|
40
|
<dd class="mt-1 text-sm text-gray-400 font-mono">{{ role.guid }}</dd> |
|
41
|
</div> |
|
42
|
<div> |
|
43
|
<dt class="text-sm font-medium text-gray-400">Created</dt> |
|
44
|
<dd class="mt-1 text-sm text-gray-400">{{ role.created_at|date:"N j, Y g:i a" }}</dd> |
|
45
|
</div> |
|
46
|
<div> |
|
47
|
<dt class="text-sm font-medium text-gray-400">Updated</dt> |
|
48
|
<dd class="mt-1 text-sm text-gray-400">{{ role.updated_at|date:"N j, Y g:i a" }}</dd> |
|
49
|
</div> |
|
50
|
</dl> |
|
51
|
</div> |
|
52
|
</div> |
|
53
|
|
|
54
|
<div class="mt-8"> |
|
55
|
<h2 class="text-lg font-semibold text-gray-100 mb-4">Permissions</h2> |
|
56
|
{% if grouped_permissions %} |
|
57
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2"> |
|
58
|
{% for category, perms in grouped_permissions.items %} |
|
59
|
<div class="overflow-hidden rounded-lg border border-gray-700 bg-gray-800 shadow-sm"> |
|
60
|
<div class="bg-gray-900 px-4 py-3"> |
|
61
|
<h3 class="text-sm font-semibold text-gray-200">{{ category }}</h3> |
|
62
|
</div> |
|
63
|
<ul class="divide-y divide-gray-700"> |
|
64
|
{% for perm in perms %} |
|
65
|
<li class="px-4 py-2 text-sm text-gray-400"> |
|
66
|
<span class="font-mono text-xs">{{ perm.codename }}</span> |
|
67
|
<span class="ml-2 text-gray-500">{{ perm.name }}</span> |
|
68
|
</li> |
|
69
|
{% endfor %} |
|
70
|
</ul> |
|
71
|
</div> |
|
72
|
{% endfor %} |
|
73
|
</div> |
|
74
|
{% else %} |
|
75
|
<p class="text-sm text-gray-400">No permissions assigned to this role.</p> |
|
76
|
{% endif %} |
|
77
|
</div> |
|
78
|
|
|
79
|
<div class="mt-8"> |
|
80
|
<h2 class="text-lg font-semibold text-gray-100 mb-4">Members with this Role</h2> |
|
81
|
<div class="overflow-x-auto rounded-lg border border-gray-700 bg-gray-800 shadow-sm"> |
|
82
|
<table class="min-w-full divide-y divide-gray-700"> |
|
83
|
<thead class="bg-gray-900"> |
|
84
|
<tr> |
|
85
|
<th class="px-6 py-3 text-left text-xs font-medium uppercase text-gray-400">Username</th> |
|
86
|
<th class="px-6 py-3 text-left text-xs font-medium uppercase text-gray-400">Email</th> |
|
87
|
<th class="px-6 py-3 text-left text-xs font-medium uppercase text-gray-400">Status</th> |
|
88
|
</tr> |
|
89
|
</thead> |
|
90
|
<tbody class="divide-y divide-gray-700 bg-gray-800"> |
|
91
|
{% for membership in role_members %} |
|
92
|
<tr class="hover:bg-gray-700/50"> |
|
93
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium"> |
|
94
|
<a href="{% url 'organization:user_detail' username=membership.member.username %}" class="text-brand-light hover:text-brand">{{ membership.member.username }}</a> |
|
95
|
</td> |
|
96
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-400">{{ membership.member.email|default:"--" }}</td> |
|
97
|
<td class="px-6 py-4 whitespace-nowrap"> |
|
98
|
{% if membership.is_active %} |
|
99
|
<span class="inline-flex rounded-full bg-green-900/50 px-2 text-xs font-semibold leading-5 text-green-300">Active</span> |
|
100
|
{% else %} |
|
101
|
<span class="inline-flex rounded-full bg-gray-700 px-2 text-xs font-semibold leading-5 text-gray-300">Inactive</span> |
|
102
|
{% endif %} |
|
103
|
</td> |
|
104
|
</tr> |
|
105
|
{% empty %} |
|
106
|
<tr> |
|
107
|
<td colspan="3" class="px-6 py-8 text-center text-sm text-gray-400">No members assigned to this role.</td> |
|
108
|
</tr> |
|
109
|
{% endfor %} |
|
110
|
</tbody> |
|
111
|
</table> |
|
112
|
</div> |
|
113
|
</div> |
|
114
|
{% endblock %} |
|
115
|
|