Skip to content
Snippets Groups Projects
Commit febf5fa9 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Display CSEntry groups in profile

There is no point displaying the LDAP groups in the profile
parent c5965f94
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,14 @@ class User(db.Model, UserMixin): ...@@ -106,6 +106,14 @@ class User(db.Model, UserMixin):
""" """
return str(self.id) return str(self.id)
@property
def csentry_groups(self):
groups = []
for key, value in current_app.config['CSENTRY_LDAP_GROUPS'].items():
if value in self.groups:
groups.append(key)
return groups
@property @property
def is_admin(self): def is_admin(self):
return current_app.config['CSENTRY_LDAP_GROUPS']['admin'] in self.groups return current_app.config['CSENTRY_LDAP_GROUPS']['admin'] in self.groups
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
<dd>{{user.name}}</dd> <dd>{{user.name}}</dd>
<dt>Email</dt> <dt>Email</dt>
<dd>{{user.email}}</dd> <dd>{{user.email}}</dd>
<dt>Groups</dt> <dt>CSEntry Groups</dt>
<dd>{{ user.groups | join(', ') }}</dd> <dd>{{ user.csentry_groups | join(', ') }}</dd>
</dl> </dl>
<h3>Personal access tokens</h3> <h3>Personal access tokens</h3>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment