From 70247bb3d876cbf9ecb6b1bbea73a667a3e2f8d9 Mon Sep 17 00:00:00 2001 From: kalugin66 Date: Tue, 3 Feb 2026 14:16:36 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=B0=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BE=D0=B1=D1=8B=D1=87=D0=BD=D1=8B=D0=B5=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B4=D0=B0=D1=87=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/main.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/public/main.js b/public/main.js index 40f6920..7ff9c87 100644 --- a/public/main.js +++ b/public/main.js @@ -110,7 +110,7 @@ async function createTask(event) { alert('Требуется аутентификация'); return; } - + const title = document.getElementById('title').value; const description = document.getElementById('description').value; const taskType = document.getElementById('task-type').value; @@ -143,6 +143,17 @@ async function createTask(event) { formData.append('files', files[i]); } + // Проверка прав для типа "regular" + const userGroups = currentUser?.groups || []; + const isAdmin = currentUser?.role === 'admin'; + const hasTasksGroup = currentUser?.role === 'tasks'; + const hasSecretaryGroup = currentUser?.role === 'secretary'; + + if (taskType === 'regular' && !(isAdmin || hasTasksGroup || hasSecretaryGroup)) { + alert('У вас нет прав для создания обычных задач. Выберите другой тип задачи.'); + return; + } + try { const response = await fetch('/api/tasks', { method: 'POST',