Skip to content
Snippets Groups Projects
Verified Commit c381e3fc authored by nd's avatar nd
Browse files

reworked user admin view

parent 03562691
No related branches found
No related tags found
No related merge requests found
from .views import bp as bp_ui from .views import bp as bp_ui
from .models import Role, RoleGroup, RoleUser
bp = [bp_ui] bp = [bp_ui]
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
</small> </small>
</div> </div>
<div class="form-group col"> <div class="form-group col">
<p> <span>Included groups</span>
Included groups
</p>
<table class="table table-striped table-sm"> <table class="table table-striped table-sm">
<thead> <thead>
<tr> <tr>
......
...@@ -3,97 +3,98 @@ ...@@ -3,97 +3,98 @@
{% block body %} {% block body %}
<form action="{{ url_for("user.update", uid=user.uid) }}" method="POST"> <form action="{{ url_for("user.update", uid=user.uid) }}" method="POST">
<div class="align-self-center"> <div class="align-self-center">
<div class="form-group col"> <ul class="nav nav-tabs " id="tablist" role="tablist">
<label for="user-uid">uid</label> <li class="nav-item">
{% if user.uid %} <a class="nav-link active" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="true">Profile</a>
<input type="number" class="form-control" id="user-uid" name="uid" value="{{ user.uid }}" readonly> </li>
{% else %} <li class="nav-item">
<input type="string" class="form-control" id="user-uid" name="uid" placeholder="will be choosen" readonly> <a class="nav-link" id="roles-tab" data-toggle="tab" href="#roles" role="tab" aria-controls="roles" aria-selected="false">Roles</a>
{% endif %} </li>
</div> <li class="nav-item">
<div class="form-group col"> <a class="nav-link" id="ldif-tab" data-toggle="tab" href="#ldif" role="tab" aria-controls="ldif" aria-selected="false">LDIF</a>
<label for="user-loginname">Login Name</label> </li>
<input type="text" class="form-control" id="user-loginname" name="loginname" value="{{ user.loginname }}" {% if user.uid %}readonly{% endif %}> </ul>
<small class="form-text text-muted"> <div class="tab-content border border-top-0 mb-2 pt-2" id="tabcontent">
Only letters, numbers and underscore ("_") are allowed. At most 32, at least 2 characters. There is a word blacklist. Musst be unique. <div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="roles-tab">
</small> <div class="form-group col">
</div> <label for="user-uid">uid</label>
<div class="form-group col"> {% if user.uid %}
<label for="user-loginname">Display Name</label> <input type="number" class="form-control" id="user-uid" name="uid" value="{{ user.uid }}" readonly>
<input type="text" class="form-control" id="user-displayname" name="displayname" value="{{ user.displayname }}"> {% else %}
<small class="form-text text-muted"> <input type="string" class="form-control" id="user-uid" name="uid" placeholder="will be choosen" readonly>
If you leave this empty it will be set to the login name. At most 128, at least 2 characters. No character restrictions. {% endif %}
</small>
</div>
<div class="form-group col">
<label for="user-mail">Mail</label>
<input type="email" class="form-control" id="user-mail" name="mail" value="{{ user.mail }}">
<small class="form-text text-muted">
Do a sanity check here. A user can take over another account if both have the same mail address set.
</small>
</div>
<div class="form-group col">
<label for="user-loginname">Password</label>
{% if user.uid %}
<input type="password" class="form-control" id="user-password" name="password" placeholder="●●●●●●●●">
{% else %}
<input type="password" class="form-control" id="user-password" name="password" placeholder="mail to set it will be sent" readonly>
{% endif %}
<small class="form-text text-muted">
At least 8 characters, no other special requirements. But please don't be stupid and use a password manager.
</small>
</div>
{% if user.uid %}
<div class="form-group col "id="accordion">
<div class="card">
<div class="card-header" id="user-ldif">
<h5 class="mb-0">
<a class="btn btn-link collapsed" data-toggle="collapse" data-target="#user-ldif-body" aria-expanded="false" aria-controls="user-ldif">
ldif
</a>
</h5>
</div> </div>
<div id="user-ldif-body" class="collapse" aria-labelledby="user-ldif" data-parent="#accordion"> <div class="form-group col">
<div class="card-body"> <label for="user-loginname">Login Name</label>
<pre>{{ user_ldif }}</pre> <input type="text" class="form-control" id="user-loginname" name="loginname" value="{{ user.loginname }}" {% if user.uid %}readonly{% endif %}>
</div> <small class="form-text text-muted">
Only letters, numbers and underscore ("_") are allowed. At most 32, at least 2 characters. There is a word blacklist. Musst be unique.
</small>
</div> </div>
</div> <div class="form-group col">
<div class="card"> <label for="user-loginname">Display Name</label>
<div class="card-header" id="user-group"> <input type="text" class="form-control" id="user-displayname" name="displayname" value="{{ user.displayname }}">
<h5 class="mb-0"> <small class="form-text text-muted">
<a class="btn btn-link collapsed" data-toggle="collapse" data-target="#user-group-body" aria-expanded="false" aria-controls="user-group"> If you leave this empty it will be set to the login name. At most 128, at least 2 characters. No character restrictions.
groups </small>
</a>
</h5>
</div> </div>
<div id="user-group-body" class="collapse" aria-labelledby="user-group" data-parent="#accordion"> <div class="form-group col">
<div class="card-body"> <label for="user-mail">Mail</label>
<ul class="list-group"> <input type="email" class="form-control" id="user-mail" name="mail" value="{{ user.mail }}">
{% for group in user.get_groups() %} <small class="form-text text-muted">
<li class="list-group-item"><a href="{{ url_for("group.show", gid=group.gid) }}">{{ group.name }}</a></li> Do a sanity check here. A user can take over another account if both have the same mail address set.
{% endfor %} </small>
</ul> </div>
</div> <div class="form-group col">
<label for="user-loginname">Password</label>
{% if user.uid %}
<input type="password" class="form-control" id="user-password" name="password" placeholder="●●●●●●●●">
{% else %}
<input type="password" class="form-control" id="user-password" name="password" placeholder="mail to set it will be sent" readonly>
{% endif %}
<small class="form-text text-muted">
At least 8 characters, no other special requirements. But please don't be stupid and use a password manager.
</small>
</div> </div>
</div> </div>
<div class="card"> <div class="tab-pane fade" id="roles" role="tabpanel" aria-labelledby="roles-tab">
<div class="card-header" id="user-role"> <div class="form-group col">
<h5 class="mb-0"> <span>Roles:</span>
<a class="btn btn-link" data-toggle="collapse" data-target="#user-role-body" aria-expanded="true" aria-controls="user-role"> </div>
roles <div class="form-group col">
</a> <span>Resulting groups (only updated after save):</span>
</h5> <table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">name</th>
<th scope="col">description</th>
</tr>
</thead>
<tbody>
{% for group in user.get_groups()|sort(attribute="name") %}
<tr id="group-{{ group.gid }}">
<td>
<a href="{{ url_for("group.show", gid=group.gid) }}">
{{ group.name }}
</a>
</td>
<td>
{{ group.description }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div> </div>
<div id="user-role-body" class="collapse show" aria-labelledby="user-role" data-parent="#accordion"> </div>
<div class="card-body"> <div class="tab-pane fade" id="ldif" role="tabpanel" aria-labelledby="ldif-tab">
roles. <div class="form-group col">
</div> <pre>{{ user_ldif }}</pre>
</div> </div>
</div> </div>
</div> </div>
{% endif %}
<div class="form-group col"> <div class="form-group col pl-0">
<button type="submit" class="btn btn-primary"><i class="fa fa-save" aria-hidden="true"></i> Save</button> <button type="submit" class="btn btn-primary"><i class="fa fa-save" aria-hidden="true"></i> Save</button>
<a href="{{ url_for("user.index") }}" class="btn btn-secondary">Cancel</a> <a href="{{ url_for("user.index") }}" class="btn btn-secondary">Cancel</a>
{% if user.uid %} {% if user.uid %}
......
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