Integrate DjangoCoreProtect (#39)
parent
8eb43887cd
commit
d658f5fa85
File diff suppressed because one or more lines are too long
|
@ -13,9 +13,6 @@ class MinecraftManagerUser(User):
|
|||
class Meta:
|
||||
proxy = True
|
||||
permissions = (
|
||||
('coreprotect_partial', 'Can use CoreProtect GUI except Command/Chat searches'),
|
||||
('coreprotect_full', 'Can use full CoreProtect GUI'),
|
||||
('coreprotect_activity', 'Can use CoreProtect Activity Monitor'),
|
||||
('bots', 'Can use the bot control page'),
|
||||
('chat', 'Can use chat page'),
|
||||
)
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
{% extends "minecraft_manager/dashboard.html" %}
|
||||
{% load template_settings %}
|
||||
{% block title %}CoreProtect GUI{% endblock %}
|
||||
{% block section %}
|
||||
<a href="{% template_settings 'COREPROTECT_WEB_URL' %}?username={{ user.username }}" target="_blank">Fullscreen</a>
|
||||
<iframe id="cpgui" width="100%" height="750px" src="{% template_settings 'COREPROTECT_WEB_URL' %}?username={{ user.username }}">Loading...</iframe>
|
||||
|
||||
<script>
|
||||
var height = $(window).height();
|
||||
//$("#cpgui").height(height * .8);
|
||||
</script>
|
||||
{% endblock section %}
|
||||
{% if show_gui and show_activity %}
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle " href="#" role="button" data-toggle="dropdown" id="cpDropdown">CoreProtect</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="cpDropdown">
|
||||
<li><a target="_blank" href="{{ url_gui }}">Web GUI</a></li>
|
||||
<li><a target="_blank" href="{{ url_activity }}">Activity Monitor</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% elif show_gui %}
|
||||
<li><a target="_blank" class="dropdown-item btn" href="{{ url_gui }}">CoreProtect GUI</a></li>
|
||||
{% elif show_activity %}
|
||||
<li><a target="_blank" class="dropdown-item btn" href="{{ url_activity }}">Activity Monitor</a></li>
|
||||
{% endif %}
|
|
@ -3,6 +3,7 @@
|
|||
{% load csrf_html %}
|
||||
{% load sidebar %}
|
||||
{% load template_settings %}
|
||||
{% load coreprotect %}
|
||||
{% block bootstrap %}
|
||||
{% if user.usersettings.default_theme == 'DA' %}
|
||||
<link rel="stylesheet" href="{% static "minecraft_manager/css/bootswatch-darkly.css" %}">
|
||||
|
@ -23,21 +24,7 @@
|
|||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{% template_settings 'COREPROTECT_WEB_URL' as CPW %}
|
||||
{% template_settings 'COREPROTECT_ACTIVITY_URL' as CPA %}
|
||||
{% if CPW %}
|
||||
{% if perms.auth.coreprotect_activity and CPA %}
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle " href="#" role="button" data-toggle="dropdown" id="cpDropdown">CoreProtect</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="cpDropdown">
|
||||
<li><a target="_blank" href="{{ CPW }}">Web GUI</a></li>
|
||||
<li><a target="_blank" href="{{ CPA }}">Activity Monitor</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% elif perms.auth.coreprotect_partial or perms.auth.coreprotect_full %}
|
||||
<li><a target="_blank" class="dropdown-item btn" href="{{ CPW }}">CoreProtect</a></li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% coreprotect %}
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle " href="#" role="button" data-toggle="dropdown" id="accountDropdown">{{ user.username }}</a>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="accountDropdown">
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
from django.template import Library
|
||||
from django.shortcuts import reverse
|
||||
|
||||
register = Library()
|
||||
|
||||
|
||||
@register.inclusion_tag('minecraft_manager/coreprotect.html', takes_context=True)
|
||||
def coreprotect(context):
|
||||
user = context.get("user", None)
|
||||
data = {"show_gui": False, "show_activity": False, "url_gui": "", "url_activity": ""}
|
||||
if user:
|
||||
try:
|
||||
data["show_gui"] = user.has_perm("django_coreprotect.gui")
|
||||
data["url_gui"] = reverse("coreprotect_gui")
|
||||
data["show_activity"] = user.has_perm("django_coreprotect.activity")
|
||||
data["url_activity"] = reverse("coreprotect_activity")
|
||||
except:
|
||||
pass
|
||||
|
||||
return data
|
3
urls.py
3
urls.py
|
@ -8,9 +8,6 @@ urlpatterns = [
|
|||
#Dashboard
|
||||
url(r'^dashboard/overview/$', login_required(mcm.Overview.as_view()), name="overview"),
|
||||
url(r'^dashboard/ban/$', login_required(mcm.Ban.as_view()), name="ban"),
|
||||
#CoreProtect
|
||||
url(r'^dashboard/coreprotect/$', login_required(mcm.CoreProtect.as_view()), name="coreprotect"),
|
||||
url(r'^dashboard/activity/$', login_required(mcm.Activity.as_view()), name="activity"),
|
||||
#Alerts
|
||||
url(r'^dashboard/alert/$', login_required(mcm.Alert.as_view()), name="alert"),
|
||||
url(r'^dashboard/alert/(?P<alert_id>[0-9]{1,5})/$', login_required(mcm.AlertInfo.as_view())),
|
||||
|
|
Loading…
Reference in New Issue