diff --git a/public/nav-task-actions.js b/public/nav-task-actions.js index bb9d8d7..f3aabe3 100644 --- a/public/nav-task-actions.js +++ b/public/nav-task-actions.js @@ -6,6 +6,10 @@ function log(...args) { if (LOG_ENABLED) console.log(...args); } + + log('currentUser:', currentUser); + log('currentUser.role:', currentUser.role); + // Сбор доступных действий для конкретной задачи function buildActionsForTask(task) { //log('buildActionsForTask called with task', task); @@ -16,7 +20,6 @@ const canEdit = window.canUserEditTask ? window.canUserEditTask(task) : false; const actions = []; - // Действия для активных (не удалённых, не закрытых) задач if (!isDeleted && !isClosed) { if (typeof openTaskChat === 'function') { @@ -32,9 +35,8 @@ log('nav-task-actions openAddFileModal not'); } } - // Специальные пользователи -if (window.currentUser && window.currentUser.login === 'minicrm') { + if (currentUser && currentUser.login === 'minicrm') { if (typeof openEditModal === 'function') { actions.push({ label: '✏️ Редактировать', handler: () => openEditModal(taskId) }); log('nav-task-actions openEditModal yes'); @@ -42,17 +44,19 @@ if (window.currentUser && window.currentUser.login === 'minicrm') { log('nav-task-actions openEditModal not'); } ////} - //if (window.currentUser && window.currentUser.login === 'kalugin.o') { + //if (currentUser && currentUser.login === 'kalugin.o') { if (typeof openManageAssigneesModal === 'function') { actions.push({ label: '👥 Управление исполнителями', handler: () => openManageAssigneesModal(taskId) }); log('nav-task-actions openManageAssigneesModal yes'); } else { log('nav-task-actions openManageAssigneesModal not'); } - //} + } + + // ${currentUser && currentUser.role === 'tasks' && canEdit || currentUser.role === 'admin' + // Администраторы и роль tasks + if (currentUser && (currentUser.role === 'admin' || (currentUser.role === 'tasks' && canEdit))) { - // Администраторы и роль tasks - //if (window.currentUser && (window.currentUser.role === 'admin' || (window.currentUser.role === 'tasks' && canEdit))) { if (typeof assignAdd_openModal === 'function') { actions.push({ label: '🧑‍💼➕ Добавить исполнителя', handler: () => assignAdd_openModal(taskId) }); log('nav-task-actions assignAdd_openModal yes'); diff --git a/public/ui.js b/public/ui.js index e4b0a43..6084005 100644 --- a/public/ui.js +++ b/public/ui.js @@ -176,7 +176,6 @@ ${currentUser && currentUser.login === 'minicrm' ? `` : ''} ${currentUser && currentUser.role === 'tasks' && canEdit || currentUser.role === 'admin' ? `` : ''} ${currentUser && currentUser.role === 'tasks' && canEdit || currentUser.role === 'admin' ? `` : ''} - ${currentUser && currentUser.login === 'minicrm' ? `` : ''} @@ -188,7 +187,6 @@ ${!isDeleted && !isClosed && task.task_type !== 'regular' && task.assignments && ` : ''} ${currentUser && currentUser.login === 'minicrm' ? `` : ''} - ${canEdit ? `` : ''} ` : ''} ${isClosed && canEdit ? ` @@ -310,7 +308,6 @@ ${currentUser && currentUser.login === 'minicrm' ? `` : ''} ${currentUser && currentUser.role === 'tasks' && canEdit || currentUser.role === 'admin' ? `` : ''} ${currentUser && currentUser.role === 'tasks' && canEdit || currentUser.role === 'admin' ? `` : ''} - ${currentUser && currentUser.login === 'minicrm' ? `` : ''}