diff --git a/boards/context_processors.py b/boards/context_processors.py
--- a/boards/context_processors.py
+++ b/boards/context_processors.py
@@ -9,7 +9,6 @@ from boards.models import Post, Tag
CONTEXT_SITE_NAME = 'site_name'
CONTEXT_VERSION = 'version'
-CONTEXT_MODERATOR = 'moderator'
CONTEXT_THEME_CSS = 'theme_css'
CONTEXT_THEME = 'theme'
CONTEXT_PPD = 'posts_per_day'
@@ -50,9 +49,6 @@ def user_and_ui_processor(request):
context[CONTEXT_THEME] = theme
context[CONTEXT_THEME_CSS] = 'css/' + theme + '/base_page.css'
- # This shows the moderator panel
- context[CONTEXT_MODERATOR] = utils.is_moderator(request)
-
context[CONTEXT_VERSION] = settings.get('Version', 'Version')
context[CONTEXT_SITE_NAME] = settings.get('Version', 'SiteName')
diff --git a/boards/models/post/__init__.py b/boards/models/post/__init__.py
--- a/boards/models/post/__init__.py
+++ b/boards/models/post/__init__.py
@@ -54,10 +54,10 @@ PARAMETER_NEED_OP_DATA = 'need_op_data'
POST_VIEW_PARAMS = (
'need_op_data',
'reply_link',
- 'moderator',
'need_open_link',
'truncated',
'mode_tree',
+ 'perms',
)
diff --git a/boards/templates/boards/all_threads.html b/boards/templates/boards/all_threads.html
--- a/boards/templates/boards/all_threads.html
+++ b/boards/templates/boards/all_threads.html
@@ -99,7 +99,7 @@
{% for thread in threads %}
- {% post_view thread.get_opening_post moderator=moderator thread=thread truncated=True need_open_link=True %}
+ {% post_view thread.get_opening_post perms=perms thread=thread truncated=True need_open_link=True %}
{% if not thread.archived %}
{% with last_replies=thread.get_last_replies %}
{% if last_replies %}
@@ -114,7 +114,7 @@
{% endwith %}
{% for post in last_replies %}
- {% post_view post moderator=moderator truncated=True %}
+ {% post_view post perms=perms truncated=True %}
{% endfor %}
{% endif %}
diff --git a/boards/templates/boards/post.html b/boards/templates/boards/post.html
--- a/boards/templates/boards/post.html
+++ b/boards/templates/boards/post.html
@@ -45,15 +45,19 @@
{% trans 'Reply' %}
{% endif %}
- {% if moderator %}
+ {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %}
- | {% trans 'Edit' %}
- {% if is_opening %}
- | {% trans 'Edit thread' %}
+ {% if perms.boards.change_post or perms.boards.delete_post %}
+ | {% trans 'Edit' %}
+
{% endif %}
-
+ {% if perms.boards.change_thread or perms_boards.delete_thread %}
+ {% if is_opening %}
+ | {% trans 'Edit thread' %}
+ {% endif %}
+ {% endif %}
{% endif %}
diff --git a/boards/templates/boards/thread_normal.html b/boards/templates/boards/thread_normal.html
--- a/boards/templates/boards/thread_normal.html
+++ b/boards/templates/boards/thread_normal.html
@@ -34,7 +34,7 @@
{% for post in thread.get_replies %}
- {% post_view post moderator=moderator reply_link=True %}
+ {% post_view post perms=perms reply_link=True %}
{% endfor %}
diff --git a/boards/utils.py b/boards/utils.py
--- a/boards/utils.py
+++ b/boards/utils.py
@@ -19,7 +19,6 @@ from boards.settings import get_bool
from neboard import settings
CACHE_KEY_DELIMITER = '_'
-PERMISSION_MODERATE = 'moderation'
HTTP_FORWARDED = 'HTTP_X_FORWARDED_FOR'
META_REMOTE_ADDR = 'REMOTE_ADDR'
@@ -103,15 +102,6 @@ def cached_result(key_method=None):
return _cached_result
-def is_moderator(request):
- try:
- moderate = request.user.has_perm(PERMISSION_MODERATE)
- except AttributeError:
- moderate = False
-
- return moderate
-
-
def get_file_hash(file) -> str:
md5 = hashlib.md5()
for chunk in file.chunks():