fix: correct permission check in feed_list.html template

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.
This commit is contained in:
admin i 2025-12-08 14:14:58 +03:00
parent 78fc34287b
commit 7388f596a6

View File

@ -15,8 +15,8 @@
<div class="col-12">
{# ===== НОВАЯ ШАПКА С КОМПОНЕНТОМ ===== #}
{# Показываем кнопку создания для: 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="Поиск по названию, автору или содержанию" %}