Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sudo #407

Merged
merged 1 commit into from
Dec 1, 2023
Merged

sudo #407

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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