Works almost
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!-- abac/templates/base.html -->
|
||||
{% load static %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -8,29 +8,32 @@
|
||||
<title>{% block title %}Privacy Preserving ABAC{% endblock %}</title>
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{% static 'abac/styles.css' %}"> <!-- Include CSS file -->
|
||||
|
||||
</head>
|
||||
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<a class="navbar-brand" href="{% url 'home' %}">Privacy Preserving ABAC</a>
|
||||
<a class="navbar-brand" href="{% url 'abac:home' %}">Privacy Preserving ABAC</a>
|
||||
<span class="navbar-text ml-auto">
|
||||
{% if user.is_authenticated %}
|
||||
{{ user.username }}
|
||||
<a class="btn btn-outline-light ml-3" href="{% url 'logout' %}">Logout</a>
|
||||
<a href="{% url 'abac:user_details' username=user.username %}"> {{ user.username }}</a>
|
||||
<a class="btn btn-outline-light ml-3" href="{% url 'abac:logout' %}">Logout</a>
|
||||
{% else %}
|
||||
<a class="btn btn-outline-light" href="{% url 'login' %}">Login</a>
|
||||
<a class="btn btn-outline-light" href="{% url 'abac:login' %}">Login</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</nav>
|
||||
{% if user.is_authenticated %}
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<button class="btn btn-primary">Upload File</button>
|
||||
<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">Create User</button>
|
||||
<button class="btn btn-primary ml-2">User Management</button>
|
||||
{% endif %}
|
||||
<span class="ml-auto">
|
||||
<button class="btn btn-primary">Upload Certificate</button>
|
||||
<button class="btn btn-primary" onclick="window.location.href='{% url 'abac:upload_certificate' %}'">Upload Certificate</button>
|
||||
</span>
|
||||
</nav>
|
||||
{% endif %}
|
||||
@@ -44,7 +47,7 @@
|
||||
|
||||
<footer class="footer mt-auto py-3 bg-dark text-white">
|
||||
<div class="container text-center">
|
||||
<span>© 2023 Privacy Preserving ABAC</span>
|
||||
<span>© 2023 Masterthesis Malte Kerl – Applications of Homomorphic Encryption in Attribute Based Access Control (ABAC) Systems </span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
26
abac/templates/file_detail.html
Normal file
26
abac/templates/file_detail.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-3">
|
||||
<h2>{{ file.name }}</h2>
|
||||
<p>Created At: {{ file.created_at|date:"F d, Y H:i" }}</p>
|
||||
<p>Last Modified: {{ file.last_modified|date:"F d, Y H:i" }}</p>
|
||||
|
||||
<form method="post" action="{% url 'abac:create_rule' file.id %}">
|
||||
{% csrf_token %}
|
||||
<label for="rule_name">Rule Name:</label>
|
||||
<input type="text" name="rule_name" required>
|
||||
<button type="submit" class="btn btn-primary">Add Rule</button>
|
||||
</form>
|
||||
|
||||
|
||||
{% for rule in rules %}
|
||||
<div class="bg-light p-3 my-2">
|
||||
<h4>{{ rule.name }}</h4>
|
||||
<a href="{% url 'abac:rule_detail' file_id=file.id rule_id=rule.id %}">View Details</a>
|
||||
</div>
|
||||
{% empty %}
|
||||
<p>No rules have been added yet.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
12
abac/templates/file_upload.html
Normal file
12
abac/templates/file_upload.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h2>Upload File</h2>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary">Upload</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,14 +1,42 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}ABAC Home{% endblock %}
|
||||
|
||||
{% block title %}Landing Page{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>All Files</h2>
|
||||
<ul>
|
||||
{% for file in files %}
|
||||
<li>{{ file.name }}</li>
|
||||
{% empty %}
|
||||
<li>No files have been uploaded yet.</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
<div class="container mt-3">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">File Name</th>
|
||||
<th scope="col">Owner</th>
|
||||
<th scope="col">Created At</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for file in files %}
|
||||
<tr data-url="{% url 'abac:file_detail' file_id=file.id %}"> <!-- Add data-url attribute here -->
|
||||
<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">
|
||||
<i class="bi bi-download"></i> Download
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">No files have been uploaded yet.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script src="{% static 'abac/main.js' %}"></script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
48
abac/templates/rule_detail.html
Normal file
48
abac/templates/rule_detail.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<header>
|
||||
<h1>{{ rule.name }}</h1>
|
||||
<p>File Owner: {{ rule.file.owner.username }}</p>
|
||||
<a href="{% url 'abac:file_detail' file_id=rule.file.id %}">Back to {{ rule.file.name }}</a>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
<h2>{{ rule.name }} Details</h2>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute Name</th>
|
||||
<th>Operator</th>
|
||||
<th>Value</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for rule_attribute in rule_attributes %}
|
||||
<tr>
|
||||
<td>{{ rule_attribute.attribute_type.name }}</td>
|
||||
<td>{{ rule_attribute.operator }}</td>
|
||||
<td>{{ rule_attribute.value }}</td>
|
||||
<td>
|
||||
<a href="{% url 'abac:delete_rule_attribute' file_id=file.id rule_id=rule.id rule_attribute_id=rule_attribute.id %}" class="btn btn-danger">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<!-- Form to add new RuleAttribute -->
|
||||
<form method="post" action="{% url 'abac:rule_detail' file_id=file.id rule_id=rule.id %}">
|
||||
{% csrf_token %}
|
||||
<td>{{ form.attribute_type }}</td>
|
||||
<td>{{ form.operator }}</td>
|
||||
<td>{{ form.value }}</td>
|
||||
<td><input type="submit" class="btn btn-success" value="Add"></td>
|
||||
</form>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
9
abac/templates/upload_certificate.html
Normal file
9
abac/templates/upload_certificate.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Upload</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
33
abac/templates/user_detail.html
Normal file
33
abac/templates/user_detail.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{{ user.username }}'s Attributes</h2>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Attribute Name</th>
|
||||
<th scope="col">Last Modified</th>
|
||||
<th scope="col">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for attribute in attributes %}
|
||||
<tr>
|
||||
<td>{{ attribute.attribute_type.name }}</td>
|
||||
<td>{{ attribute.last_modified|date:"F d, Y H:i" }}</td>
|
||||
<td>
|
||||
{% if not attribute.attribute_type.is_private %}
|
||||
{{ attribute.value }}
|
||||
{% else %}
|
||||
<i>Private</i>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="3">This user has no attributes.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user