Update Private user attributes

This commit is contained in:
2023-09-28 18:47:37 +02:00
parent 92546024d8
commit ac52768ca7
9 changed files with 144 additions and 92 deletions

View File

@@ -29,8 +29,8 @@
{% if user.is_authenticated %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<button class="btn btn-primary" onclick="window.location.href='{% url 'abac:upload_file' %}'">Upload File</button>
{% if perms.abac.can_create_users %}
<button class="btn btn-primary ml-2">User Management</button>
{% if user.is_superuser %}
<a href="{% url 'abac:user_management' %}" class="btn btn-primary ml-2">User Management</a>
{% endif %}
<span class="ml-auto">
<button class="btn btn-primary" onclick="window.location.href='{% url 'abac:upload_certificate' %}'">Upload Certificate</button>

View File

@@ -17,14 +17,14 @@
</thead>
<tbody>
{% for file in files %}
<tr data-url="{% url 'abac:file_detail' file_id=file.id %}"> <!-- Add data-url attribute here -->
<tr data-url="{% url 'abac:file_detail' file_id=file.id %}">
<td>{{ file.name }}</td>
<td>{{ file.owner.username }}</td>
<td>{{ file.created_at|date:"F d, Y H:i" }}</td>
<td>
<a href="{{ file.file.url }}" download="{{ file.name }}" class="btn btn-outline-primary btn-sm">
<a href="{% url 'abac:download_file' file.id %}" class="btn btn-outline-primary btn-sm">
<i class="bi bi-download"></i> Download
</a>
</a>
</td>
</tr>
{% empty %}

View File

@@ -0,0 +1,45 @@
{% extends 'base.html' %}
{% block title %}User Management{% endblock %}
{% block content %}
<form method="post" class="mb-3">
{% csrf_token %}
<div class="form-row align-items-center">
<div class="col-auto">
<label class="sr-only" for="username">Username</label>
<input type="text" class="form-control mb-2" id="username" name="username" placeholder="Username" required>
</div>
<div class="col-auto">
<label class="sr-only" for="password">Password</label>
<input type="password" class="form-control mb-2" id="password" name="password" placeholder="Password" required>
</div>
<div class="col-auto">
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" id="is_superuser" name="is_superuser">
<label class="form-check-label" for="is_superuser">Superuser</label>
</div>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary mb-2">Create User</button>
</div>
</div>
</form>
<table class="table table-striped">
<thead>
<tr>
<th>Username</th>
<th>Is Superuser</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td><a href="{% url 'abac:user_details' username=user.username %}">{{ user.username }}</a></td>
<td>{{ user.is_superuser|yesno:"Yes,No" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}