Skip to content

Commit

Permalink
add ability to sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
Her Email authored and alphatownsman committed Dec 1, 2023
1 parent af747a3 commit 5ed8f4c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion boofilsic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
with open(os.path.join(BASE_DIR, "build_version")) as f:
NEODB_VERSION = __version__ + "-" + f.read().strip()
except:
NEODB_VERSION = __version__ + "-dev"
NEODB_VERSION = __version__ + "-unknown"


# Parse configuration from:
Expand Down Expand Up @@ -155,6 +155,7 @@

SITE_DOMAIN = env("NEODB_SITE_DOMAIN")
SITE_INFO = {
"neodb_version": NEODB_VERSION,
"site_name": env("NEODB_SITE_NAME"),
"site_domain": SITE_DOMAIN,
"site_url": env("NEODB_SITE_URL", default="https://" + SITE_DOMAIN),
Expand Down
1 change: 1 addition & 0 deletions common/templates/_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<a class="footer__link" href="{% url 'management:list' %}">公告栏</a>
<a class="footer__link" href="{% url 'oauth2_provider:developer' %}">应用开发</a>
<a class="footer__link"
title="{{ neodb_version }}"
target="_blank"
rel="noopener"
href="https://github.com/neodb-social">源代码</a>
Expand Down
11 changes: 11 additions & 0 deletions common/templates/_sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,17 @@ <h6 class="nickname">{{ identity.display_name }}</h6>
{% if sidebar_template %}
{% include sidebar_template %}
{% endif %}
{% if request.user.is_superuser and identity.local and request.user.identity != identity and request.GET.sudo %}
<section class="hijacker">
<form action="{% url 'hijack:acquire' %}" method="post">
{% csrf_token %}
<input type="hidden" name="user_pk" value="{{ identity.user.pk }}">
<button type="submit">View as them</button>
<button _="on click hide .hijacker then halt default">Hide</button>
<input type="hidden" name="next" value="{{ request.path }}">
</form>
</section>
{% endif %}
</aside>
<script>
$(function () {
Expand Down
1 change: 1 addition & 0 deletions management/templates/management/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<main class="container">
<h1 class="header">
{% trans '公告栏' %}
{% if request.user.is_superuser %}🦹🏻{% endif %}
{% if request.user.is_staff %}🧙🏻{% endif %}
</h1>
{% if request.user.is_superuser %}
Expand Down

0 comments on commit 5ed8f4c

Please sign in to comment.