add ability to sudo
This commit is contained in:
parent
af747a380f
commit
5ed8f4c23f
4 changed files with 15 additions and 1 deletions
|
@ -10,7 +10,7 @@ try:
|
|||
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:
|
||||
|
@ -155,6 +155,7 @@ elif _parsed_email_url.scheme:
|
|||
|
||||
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),
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -213,6 +213,17 @@
|
|||
{% 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 () {
|
||||
|
|
|
@ -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 %}
|
||||
|
|
Loading…
Add table
Reference in a new issue