mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
Allow admin tools page to be used by editors
This makes it easier to find certain tools
This commit is contained in:
parent
4c5b506053
commit
50b860233b
@ -28,9 +28,9 @@ from ...querybuilder import QueryBuilder
|
|||||||
|
|
||||||
|
|
||||||
@bp.route("/admin/", methods=["GET", "POST"])
|
@bp.route("/admin/", methods=["GET", "POST"])
|
||||||
@rank_required(UserRank.ADMIN)
|
@rank_required(UserRank.EDITOR)
|
||||||
def admin_page():
|
def admin_page():
|
||||||
if request.method == "POST":
|
if request.method == "POST" and current_user.rank.at_least(UserRank.ADMIN):
|
||||||
action = request.form["action"]
|
action = request.form["action"]
|
||||||
if action in actions:
|
if action in actions:
|
||||||
ret = actions[action]["func"]()
|
ret = actions[action]["func"]()
|
||||||
@ -40,8 +40,7 @@ def admin_page():
|
|||||||
else:
|
else:
|
||||||
flash("Unknown action: " + action, "danger")
|
flash("Unknown action: " + action, "danger")
|
||||||
|
|
||||||
deleted_packages = Package.query.filter(Package.state == PackageState.DELETED).all()
|
return render_template("admin/list.html", actions=actions)
|
||||||
return render_template("admin/list.html", deleted_packages=deleted_packages, actions=actions)
|
|
||||||
|
|
||||||
|
|
||||||
class SwitchUserForm(FlaskForm):
|
class SwitchUserForm(FlaskForm):
|
||||||
|
@ -5,25 +5,90 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<h1>{{ self.title() }}</h1>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
<h3 class="mt-0">Users</h3>
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('users.list_all') }}">User list</a>
|
<a class="list-group-item list-group-item-action" href="{{ url_for('users.list_all') }}">
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.restore') }}">Restore package</a>
|
<i class="fas fa-users me-2"></i>
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.transfer') }}">Transfer package(s)</a>
|
User list
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.tag_list') }}">Tag Editor</a>
|
</a>
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.license_list') }}">License Editor</a>
|
{% if current_user.rank.at_least(current_user.rank.MODERATOR) %}
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.version_list') }}">Version Editor</a>
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.audit') }}">
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.warning_list') }}">Warning Editor</a>
|
<i class="fas fa-user-clock me-2"></i>
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.send_bulk_email') }}">Send bulk email</a>
|
{{ _("Audit Log") }}
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.send_bulk_notification') }}">Send bulk notification</a>
|
</a>
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.storage') }}">Storage usage</a>
|
{% endif %}
|
||||||
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.switch_user') }}">Sign in as another user</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3>Packages</h3>
|
||||||
|
<div class="list-group">
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.restore') }}">
|
||||||
|
<i class="fas fa-trash-restore me-2"></i>
|
||||||
|
Restore package
|
||||||
|
</a>
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.transfer') }}">
|
||||||
|
<i class="fas fa-arrow-right me-2"></i>
|
||||||
|
Transfer package(s)
|
||||||
|
</a>
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.storage') }}">
|
||||||
|
<i class="fas fa-save me-2"></i>
|
||||||
|
Storage usage
|
||||||
|
</a>
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('zipgrep.zipgrep_search') }}">
|
||||||
|
<i class="fas fa-search me-2"></i>
|
||||||
|
Zip grep
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>Types</h3>
|
||||||
|
<div class="list-group">
|
||||||
|
{% if check_global_perm(current_user, "EDIT_TAGS") %}
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.tag_list') }}">
|
||||||
|
<i class="fas fa-tags me-2"></i>
|
||||||
|
Tag Editor
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if current_user.rank.at_least(current_user.rank.MODERATOR) %}
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.license_list') }}">
|
||||||
|
<i class="fas fa-balance-scale me-2"></i>
|
||||||
|
License Editor
|
||||||
|
</a>
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.version_list') }}">
|
||||||
|
<i class="fas fa-code me-2"></i>
|
||||||
|
Version Editor
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if current_user.rank.at_least(current_user.rank.ADMIN) %}
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.warning_list') }}">
|
||||||
|
<i class="fas fa-exclamation-triangle me-2"></i>
|
||||||
|
Warning Editor
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if current_user.rank.name == "ADMIN" %}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="card mb-4">
|
<h3 class="mt-0">Admin</h3>
|
||||||
|
<div class="list-group">
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.send_bulk_email') }}">
|
||||||
|
<i class="fas fa-envelope me-2"></i>
|
||||||
|
Send bulk email
|
||||||
|
</a>
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.send_bulk_notification') }}">
|
||||||
|
<i class="fas fa-circle me-2"></i>
|
||||||
|
Send bulk notification
|
||||||
|
</a>
|
||||||
|
<a class="list-group-item list-group-item-action" href="{{ url_for('admin.switch_user') }}">
|
||||||
|
<i class="fas fa-user me-2"></i>
|
||||||
|
Sign in as another user
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="card my-4">
|
||||||
<h2 class="card-header">Do action</h2>
|
<h2 class="card-header">Do action</h2>
|
||||||
|
|
||||||
<form method="post" action="" class="card-body">
|
<form method="post" action="" class="card-body">
|
||||||
@ -41,5 +106,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -159,21 +159,9 @@
|
|||||||
{{ _("Audit Log") }}
|
{{ _("Audit Log") }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if current_user.rank == current_user.rank.ADMIN %}
|
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('admin.admin_page') }}">{{ _("Admin") }}</a></li>
|
|
||||||
{% else %}
|
|
||||||
{% if current_user.rank == current_user.rank.MODERATOR %}
|
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('admin.license_list') }}">{{ _("License Editor") }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if current_user.rank.at_least(current_user.rank.EDITOR) %}
|
{% if current_user.rank.at_least(current_user.rank.EDITOR) %}
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('admin.restore') }}">{{ _("Restore Package") }}</a></li>
|
<li class="nav-item"><a class="nav-link" href="{{ url_for('admin.admin_page') }}">{{ _("Admin") }}</a></li>
|
||||||
{% endif %}
|
|
||||||
{% if check_global_perm(current_user, "EDIT_TAGS") %}
|
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('admin.tag_list') }}">{{ _("Tag Editor") }}</a></li>
|
|
||||||
{% elif check_global_perm(current_user, "CREATE_TAG") %}
|
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('admin.create_edit_tag') }}">{{ _("Create Tag") }}</a></li>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="dropdown-divider"></li>
|
<li class="dropdown-divider"></li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
Loading…
Reference in New Issue
Block a user