1 {% extends 'base.html' %}
4 <h1>{% block title %}User Administration{% endblock %}
</h1>
5 <a class=
"action" href=
"{{ url_for('index') }}">Index
</a>
11 <th>Username
</th><th>Permission
</th><th>Action
</th>
13 {% for user in users %}
15 <td>{{ user.username }}
</td>
17 <select name=
"perm" id=
"perm{{user.id}}">
18 {% for perm in perms %}
19 {% if perm.name == user.name %}
20 <option value=
"{{ perm.id }}" selected
>{{ perm.name }}
</option>
22 <option value=
"{{ perm.id }}">{{ perm.name }}
</option>
29 {% if g.user.id == user.id %}
30 <button type=
"button" onclick=
"submit_update({{user.id}})">update
</button>
31 |
<button type=
"button" onclick=
"submit_chpwd({{user.id}})">change password
</button>
33 <button type=
"button" onclick=
"submit_update({{user.id}})">update
</button>
34 |
<button type=
"button" onclick=
"submit_delete({{user.id}})">delete
</button>
35 |
<button type=
"button" onclick=
"submit_chpwd({{user.id}})">change password
</button>
41 <script type=
"text/javascript">
42 function submit_update(id) {
43 var perm = document.getElementById("perm"+id).value;
44 var url = '/auth/userupdate/'+id;
48 'Content-Type': 'application/json'
50 body: JSON.stringify({ "perm_id": parseInt(perm) })
55 <script type=
"text/javascript">
56 function submit_delete(id) {
57 fetch('/auth/userdelete/'+id, {
60 'Content-Type': 'application/json'
64 document.location.replace('/auth/update');
68 <script type=
"text/javascript">
69 function submit_chpwd(id) {
70 document.location.replace('/auth/changepwd/'+id);