From 3ec541628c33bf6235cdbe6aa8d50d929fc55b46 Mon Sep 17 00:00:00 2001
From: Tobias Kunze <r@rixx.de>
Date: Sat, 12 Jun 2021 22:26:12 +0200
Subject: [PATCH] Show current user roles on self service page

Refs #54
---
 uffd/selfservice/templates/selfservice/self.html | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/uffd/selfservice/templates/selfservice/self.html b/uffd/selfservice/templates/selfservice/self.html
index 7cb7bf56..e3ce9467 100644
--- a/uffd/selfservice/templates/selfservice/self.html
+++ b/uffd/selfservice/templates/selfservice/self.html
@@ -40,6 +40,22 @@
 		<label for="user-password2">Password Repeat</label>
 		<input type="password" class="form-control" id="user-password2" name="password2" placeholder="●●●●●●●●">
 	</div>
+	<div class="form-group">
+		{% if user.roles_recursive|length %}
+			{% if user.roles_recursive|length == 1 %}
+				You have this role:
+			{% else %}
+				You currently have these roles:
+			{% endif %}
+			<ul>
+				{% for role in user.roles_recursive|sort(attribute="name") %}
+				<li>{{ role.name }}</li>
+				{% endfor %}
+			</ul>
+		{% else %}
+			You currently don't have any roles.
+		{% endif %}
+	</div>
 	<div class="form-group col-md-12">
 		<button type="submit" class="btn btn-primary float-right"><i class="fa fa-save" aria-hidden="true"></i> Save</button>
 	</div>
-- 
GitLab