Cedar now uses Django's Perms and groups.

You'll have to do some manual editing to give yourself superuser.

- /admin/ now uses perms and groups. So you can fine tune who has access to what model.
- Moved the metadata button to the user sidebar
- Removed metaview lists from showing in user settings and in the metadata page.
This commit is contained in:
some weird guy
2023-09-15 16:03:37 -07:00
parent 4bd55cbed1
commit 61ca96d37d
9 changed files with 155 additions and 179 deletions
@@ -121,6 +121,9 @@
</a>
<a href={% url "main:user-tools-bans" user.username %} class="sidebar-admin-bans symbol{% if selection == 9 %} selected{% endif %}">
<span>Ban User</span>
</a>
<a href={% url "main:user-tools-meta" user.username %} class="sidebar-admin-meta symbol{% if selection == 10 %} selected{% endif %}">
<span>View Metadata</span> <!--Too lazy to hide this for now. It will error out if you don't have a high enough level.-->
</a>
</div>
</div>
@@ -9,7 +9,7 @@
<h3>General account information:</h3>
<p>IP address: <span>{% if user.addr %}{{ user.addr }}{% else %}Data missing{% endif %}
<p>Signup IP address: <span>{% if user.signup_addr %}{{ user.signup_addr }}{% else %}Data missing{% endif %}</p>
<p>Rank: <span>{% if user.staff %}You are a staff member.{% elif not user.level <= 0 %}You are a moderator. (Level {{ user.level }}){% else %}You are a regular user.{% endif %}
<p>Rank: <span>{% if user.is_staff %}You are a staff member.{% elif not user.level <= 0 %}You are a moderator. (Level {{ user.level }}){% else %}You are a regular user.{% endif %}
<h3>My content:</h3>
<p>Your account has existed for {{ user.created|timesince }}! During that time, we've collected:</p>
<ul>
@@ -20,16 +20,12 @@
<li>My notifications: <span> {{ notifications }}
</ul>
<h3>Restrictions:</h3>
{% if request.user.active %}
<ul>
<li>Sending images and creating new accounts: <span> {% if user.has_freedom %}Good standing{% else %}Restricted{% endif %}
<li>Post limit: <span> {% if request.user.profile.limit_post == 0 %}Good standing{% else %}{{ user.profile.limit_post }}{% endif %}
<li>Editing your profile: <span> {% if not user.profile.cannot_edit %}Good standing{% else %}Restricted{% endif %}
<li>Creating invites: <span> {% if user.can_invite %}Good standing{% else %}Restricted{% endif %}
</ul>
{% else %}
<p class='center'>You've been fucking banned lmao</p>
{% endif %}
<h3>Collected data:</h3>
<div class="user-data">
<p class="label">Account login history:</p>
@@ -56,68 +56,23 @@
<p class='note'>{{ field.help_text }}</p>
{% endfor %}
</li>
<li class="setting">
<div class="center center-input">
<p class="settings-label">Metadata:</p>
<div class="user-data">
<p>Rank: <span>{% if user.staff %}Staff member.{% elif not user.level <= 0 %}Moderator. (Level {{ user.level }}){% else %}Regular user.{% endif %}
<p>&nbsp;</p>
</div>
{% if request.user.level >= min_lvl_metadata_perms %}
<a class='button' href="{% url "main:user-tools-meta" user.username %}">View private info</a>
{% endif %}
</div>
</li>
{% if accountmatch %}
<h3>Account(s) found with the same IP address.</h3>
<div class="user-data">
<table style="width:100%">
<tr>
<th>Created</th>
<th>Match</th>
</tr>
{% for accountmatch in accountmatch %}
<tr>
<td>{{ accountmatch.created }}</td>
<td><a href={% url "main:user-view" accountmatch.username %}>{{ accountmatch.username }}</a></td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% if seen_by %}
<h3>Account viewed by:</h3>
<div class="user-data">
<table style="width:100%">
<tr>
<th>Time</th>
<th>Seen by</th>
</tr>
{% for seen_by in seen_by %}
<tr>
<td>{{ seen_by.created }}</td>
<td>{{ seen_by.from_user }}</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% if has_seen %}
<h3>This user has viewed:</h3>
<div class="user-data">
<table style="width:100%">
<tr>
<th>Time</th>
<th>Seen</th>
</tr>
{% for has_seen in has_seen %}
<tr>
<td>{{ has_seen.created }}</td>
<td>{{ has_seen.target_user }}</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
</li>
{% csrf_token %}
<div class="form-buttons">
<input type="submit" class="black-button apply-button" value="Save">
@@ -1,5 +1,6 @@
{% extends "closedverse_main/layout.html" %}
{% block main-body %}{% load closedverse_user %}{% load closedverse_tags %}
{% user_sidebar request user profile 10 False %}
<div id="help" class="main-column">
<div class="post-list-outline">
<h2 class="label">View info for {{ user.username }}</h2>
@@ -11,7 +12,7 @@
<p>IP address: <span>{% if user.addr %}{{ user.addr }}{% else %}Data missing{% endif %}
<p>Signup IP address: <span>{% if user.signup_addr %}{{ user.signup_addr }}{% else %}Data missing{% endif %}</p>
<p>Email: <span>{% if user.email %}{{ user.email }}{% else %}Data missing{% endif %}
<p>Rank: <span>{% if user.staff %}Staff member.{% elif not user.level <= 0 %}Moderator. (Level {{ user.level }}){% else %}Regular user.{% endif %}
<p>Rank: <span>{% if user.is_staff %}Staff member.{% elif not user.level <= 0 %}Moderator. (Level {{ user.level }}){% else %}Regular user.{% endif %}
</div>
{% if accountmatch %}
<h3>Account(s) found with the same IP address.</h3>
@@ -36,14 +37,12 @@
<table style="width:100%">
<tr>
<th>Time</th>
<th>Success</th>
<th class="ip">IP</th>
<th>User agent</th>
</tr>
{% for log_attempt in log_attempt %}
<tr>
<td>{{ log_attempt.created }}</td>
<td{% if not log_attempt.success %} style="border: #f44336 2px solid;"{% endif %}>{{ log_attempt.success }}</td>
<td class="ip">{{ log_attempt.addr }}</td>
<td>{{ log_attempt.user_agent }}
</tr>
@@ -53,27 +52,6 @@
{% else %}
<p>Error: No login history to report, it was likely deleted.</p>
{% endif %}
{% if seen_by %}
<h3>Account viewed by:</h3>
<div class="user-data">
<table style="width:100%">
<tr>
<th>Time</th>
<th>Seen by</th>
</tr>
{% for seen_by in seen_by %}
<tr>
<td>{{ seen_by.created }}</td>
<td>{{ seen_by.from_user }}</td>
</tr>
{% endfor %}
</table>
</div>
{% else %}
<p>Error: No view history to report, it was likely deleted.</p>
{% endif %}
<p class='red'>Do I need to state the obvious? Please don't share this, ever!</p>
</div></div></div></div>
{% endblock %}