Skip to content

Commit

Permalink
Show user info in user table
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Dec 12, 2023
1 parent b0742bc commit 00be6ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 7 additions & 2 deletions openatlas/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def admin_index(
'entities'],
defs=[{'className': 'dt-body-right', 'targets': 7}]),
'content': Table(['name'] + list(app.config['LANGUAGES']))}
if is_authorized('manager'):
tables['user'].header.append(_('info'))
newsletter = False
for user in User.get_all():
if user.settings['newsletter']:
Expand All @@ -83,15 +85,18 @@ def admin_index(
f'{format_number(count)}</a>'
email = user.email \
if is_authorized('manager') or user.settings['show_email'] else ''
tables['user'].rows.append([
row = [
link(user),
user.real_name,
user.group,
email,
_('yes') if user.settings['newsletter'] else '',
format_date(user.created),
format_date(user.login_last_success),
user_entities])
user_entities]
if is_authorized('editor'):
row.append(user.description)
tables['user'].rows.append(row)
for item, languages in get_content().items():
content = [_(item)]
for language in app.config['LANGUAGES']:
Expand Down
3 changes: 1 addition & 2 deletions openatlas/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,14 @@ def user_view(id_: int) -> str:
@app.route('/admin/user/entities/<int:id_>')
@required_group('readonly')
def user_entities(id_: int) -> str:
user = User.get_by_id(id_)
table = Table([
'name',
'class',
'type',
'begin',
'end',
'created'])
if user:
if user := User.get_by_id(id_):
for entity in user.get_entities():
table.rows.append([
link(entity),
Expand Down

0 comments on commit 00be6ba

Please sign in to comment.