From 6162d9f16ea04fb17fe6f6c9c9c20ac7f305a0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=9D=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Mon, 8 Dec 2025 14:14:58 +0300 Subject: [PATCH] fix: correct permission check in feed_list.html template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed from non-existent permissions: - perms.feed.publish_company_post - perms.feed.publish_department_post To actual Django model permission: - perms.feed.add_post User diagnosis confirmed: - User has Position 'СММ специалист' - Position linked to Group 'Дизайн СММ Реклама' - Group has permissions: add_post, change_post, delete_post, view_post - PositionRoleBackend correctly grants these permissions The 'Create Post' button will now appear for users with feed.add_post permission through their position groups. --- backend/templates/feed/feed_list.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/templates/feed/feed_list.html b/backend/templates/feed/feed_list.html index da8ae7b2..6c2beaf6 100644 --- a/backend/templates/feed/feed_list.html +++ b/backend/templates/feed/feed_list.html @@ -15,8 +15,8 @@
{# ===== НОВАЯ ШАПКА С КОМПОНЕНТОМ ===== #} - {# Показываем кнопку создания для: staff ИЛИ тех, у кого есть права на публикацию #} - {% if user.is_authenticated and user.is_staff or perms.feed.publish_company_post or perms.feed.publish_department_post %} + {# Показываем кнопку создания для: staff ИЛИ тех, у кого есть право add_post #} + {% if user.is_authenticated and user.is_staff or perms.feed.add_post %} {% include "includes/components/page_header.html" with icon="bi-megaphone" title="Лента" search_id="feedFilter" search_placeholder="Поиск по названию, автору или содержанию" create_as_card=True create_modal="createPostModal" create_text="Создать публикацию" %} {% else %} {% include "includes/components/page_header.html" with icon="bi-megaphone" title="Лента" search_id="feedFilter" search_placeholder="Поиск по названию, автору или содержанию" %}