21 lines
684 B
Python
21 lines
684 B
Python
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
|