feat(usermanager): show summary on index view
This commit is contained in:
parent
b96cbbde25
commit
1cda01eb1f
@ -38,12 +38,17 @@
|
|||||||
</button>
|
</button>
|
||||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||||
|
{% if g.is_authenticated %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ url_for('usermanager.user_list') }}">Users</a>
|
<a class="nav-link" href="{{ url_for('usermanager.user_list') }}">Users</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ url_for('usermanager.group_list') }}">Groups</a>
|
<a class="nav-link" href="{{ url_for('usermanager.group_list') }}">Groups</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% endif%}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">About</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% if g.is_authenticated %}
|
{% if g.is_authenticated %}
|
||||||
<div class="d-flex"">
|
<div class="d-flex"">
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1 class="text-center">Welcome to LUMI 2</h1>
|
<h1 class="text-center">Welcome</h1>
|
||||||
<div class="row justify-content-md-center">
|
<div class="row justify-content-md-center">
|
||||||
<img src="{{ url_for('static', filename='images/base/toolbox.svg') }}"
|
<img src="{{ url_for('static', filename='images/base/navbar-logo.svg') }}"
|
||||||
alt="Picture of a toolbox."
|
alt="Logo for lumi2"
|
||||||
class="img-fluid rounded"
|
class="img-fluid rounded"
|
||||||
style="max-width: 400px"
|
style="max-width: 400px"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-md-center text-center">
|
<div class="row justify-content-md-centermt-4">
|
||||||
<p class="fs-3 text-secondary"><i class="bi-cone-striped"></i> This site is still under construction.</p>
|
<p class="fs-3 text-secondary text-center "><i class="bi-cone-striped"></i> This site is still under construction <i class="bi-cone-striped"></i></p>
|
||||||
|
<p class="fs-3">With Lumi2 you can easily manage the users and user-groups on your LDAP server.</p>
|
||||||
|
{% if g.is_authenticated %}
|
||||||
|
<p class="fs-3">There are currently {{ user_count }} <a href="{{ url_for('usermanager.user_list') }}">users</a> and {{ group_count }} <a href="{{ url_for('usermanager.group_list') }}">groups</a>.</p>
|
||||||
|
{% else %}
|
||||||
|
<p class="fs-3">You are currently not logged in. Please <a href="{{ url_for('auth.login') }}">log in</a> to continue.</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -6,7 +6,7 @@ from tempfile import TemporaryFile
|
|||||||
from json import loads, dumps, JSONDecodeError
|
from json import loads, dumps, JSONDecodeError
|
||||||
|
|
||||||
from flask import (
|
from flask import (
|
||||||
Blueprint, render_template, abort, request, flash, redirect, url_for, current_app
|
Blueprint, render_template, abort, request, flash, redirect, url_for, current_app, g
|
||||||
)
|
)
|
||||||
from PIL import Image, UnidentifiedImageError
|
from PIL import Image, UnidentifiedImageError
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
@ -56,6 +56,21 @@ def _initialize_ldap_dit():
|
|||||||
def index():
|
def index():
|
||||||
"""Home page view."""
|
"""Home page view."""
|
||||||
|
|
||||||
|
if g.is_authenticated:
|
||||||
|
try:
|
||||||
|
conn = ldap.get_connection()
|
||||||
|
except Exception:
|
||||||
|
abort(500)
|
||||||
|
|
||||||
|
user_count = len(ldap.get_users(conn))
|
||||||
|
group_count = len(ldap.get_groups(conn))
|
||||||
|
conn.unbind()
|
||||||
|
return render_template(
|
||||||
|
'usermanager/index.html',
|
||||||
|
user_count=user_count,
|
||||||
|
group_count=group_count
|
||||||
|
)
|
||||||
|
|
||||||
return render_template('usermanager/index.html')
|
return render_template('usermanager/index.html')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user