права на обычные задачи
This commit is contained in:
@@ -143,6 +143,17 @@ async function createTask(event) {
|
|||||||
formData.append('files', files[i]);
|
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 {
|
try {
|
||||||
const response = await fetch('/api/tasks', {
|
const response = await fetch('/api/tasks', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
Reference in New Issue
Block a user