заявки
This commit is contained in:
@@ -130,6 +130,54 @@ db.run(`
|
|||||||
description: 'Идентификаторы из других систем',
|
description: 'Идентификаторы из других систем',
|
||||||
service_type: 'other',
|
service_type: 'other',
|
||||||
is_active: true
|
is_active: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Секретарь',
|
||||||
|
description: 'согласование документов',
|
||||||
|
service_type: 'other',
|
||||||
|
is_active: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ИТ специалист',
|
||||||
|
description: 'ИТ специалисты',
|
||||||
|
service_type: 'other',
|
||||||
|
is_active: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'АХЧ',
|
||||||
|
description: 'сотрудники АХЧ',
|
||||||
|
service_type: 'other',
|
||||||
|
is_active: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'психолог',
|
||||||
|
description: 'сотрудники психологи',
|
||||||
|
service_type: 'other',
|
||||||
|
is_active: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'логопед',
|
||||||
|
description: 'сотрудники логопеды',
|
||||||
|
service_type: 'other',
|
||||||
|
is_active: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'кадровичка',
|
||||||
|
description: 'сотрудники кадровой службы',
|
||||||
|
service_type: 'other',
|
||||||
|
is_active: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Администрация',
|
||||||
|
description: 'секретари и завучи',
|
||||||
|
service_type: 'other',
|
||||||
|
is_active: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Админ ЭЖ',
|
||||||
|
description: 'администраторы электронного журнала',
|
||||||
|
service_type: 'other',
|
||||||
|
is_active: true
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
112
public/main.js
112
public/main.js
@@ -143,6 +143,118 @@ async function createTask(event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Дополнительная проверка для задач типа "it"
|
||||||
|
if (taskType === 'it' && selectedUsers.length > 0) {
|
||||||
|
// Проверяем, что все выбранные пользователи - it
|
||||||
|
for (const userId of selectedUsers) {
|
||||||
|
const groups = await getUserGroups(userId);
|
||||||
|
const hasSecretaryGroup = groups.some(group =>
|
||||||
|
group.name === 'IT поддержка' ||
|
||||||
|
(typeof group === 'string' && group.includes('IT поддержка'))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hasSecretaryGroup) {
|
||||||
|
alert('Для задачи можно выбирать только пользователей из группы "IT поддержка"');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Дополнительная проверка для задач типа "ahch"
|
||||||
|
if (taskType === 'ahch' && selectedUsers.length > 0) {
|
||||||
|
// Проверяем, что все выбранные пользователи - it
|
||||||
|
for (const userId of selectedUsers) {
|
||||||
|
const groups = await getUserGroups(userId);
|
||||||
|
const hasSecretaryGroup = groups.some(group =>
|
||||||
|
group.name === 'АХЧ' ||
|
||||||
|
(typeof group === 'string' && group.includes('АХЧ'))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hasSecretaryGroup) {
|
||||||
|
alert('Для задачи можно выбирать только пользователей из группы "сотрудники АХЧ"');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Дополнительная проверка для задач типа "psychologist"
|
||||||
|
if (taskType === 'psychologist' && selectedUsers.length > 0) {
|
||||||
|
// Проверяем, что все выбранные пользователи - it
|
||||||
|
for (const userId of selectedUsers) {
|
||||||
|
const groups = await getUserGroups(userId);
|
||||||
|
const hasSecretaryGroup = groups.some(group =>
|
||||||
|
group.name === 'психолог' ||
|
||||||
|
(typeof group === 'string' && group.includes('психолог'))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hasSecretaryGroup) {
|
||||||
|
alert('Для задачи можно выбирать только пользователей из группы "сотрудники психологи"');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Дополнительная проверка для задач типа "speech_therapist"
|
||||||
|
if (taskType === 'speech_therapist' && selectedUsers.length > 0) {
|
||||||
|
// Проверяем, что все выбранные пользователи - speech_therapist
|
||||||
|
for (const userId of selectedUsers) {
|
||||||
|
const groups = await getUserGroups(userId);
|
||||||
|
const hasSecretaryGroup = groups.some(group =>
|
||||||
|
group.name === 'логопед' ||
|
||||||
|
(typeof group === 'string' && group.includes('логопед'))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hasSecretaryGroup) {
|
||||||
|
alert('Для задачи можно выбирать только пользователей из группы "сотрудники логопеды"');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Дополнительная проверка для задач типа "hr"
|
||||||
|
if (taskType === 'hr' && selectedUsers.length > 0) {
|
||||||
|
// Проверяем, что все выбранные пользователи - hr
|
||||||
|
for (const userId of selectedUsers) {
|
||||||
|
const groups = await getUserGroups(userId);
|
||||||
|
const hasSecretaryGroup = groups.some(group =>
|
||||||
|
group.name === 'кадровичка' ||
|
||||||
|
(typeof group === 'string' && group.includes('кадровичка'))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hasSecretaryGroup) {
|
||||||
|
alert('Для задачи можно выбирать только пользователей из группы "сотрудники кадровой службы"');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Дополнительная проверка для задач типа "certificate"
|
||||||
|
if (taskType === 'certificate' && selectedUsers.length > 0) {
|
||||||
|
// Проверяем, что все выбранные пользователи - certificate
|
||||||
|
for (const userId of selectedUsers) {
|
||||||
|
const groups = await getUserGroups(userId);
|
||||||
|
const hasSecretaryGroup = groups.some(group =>
|
||||||
|
group.name === 'Администрация' ||
|
||||||
|
(typeof group === 'string' && group.includes('Администрация'))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hasSecretaryGroup) {
|
||||||
|
alert('Для задачи можно выбирать только пользователей из группы "секретари и завучи"');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Дополнительная проверка для задач типа "e_journal"
|
||||||
|
if (taskType === 'e_journal' && selectedUsers.length > 0) {
|
||||||
|
// Проверяем, что все выбранные пользователи - e_journal
|
||||||
|
for (const userId of selectedUsers) {
|
||||||
|
const groups = await getUserGroups(userId);
|
||||||
|
const hasSecretaryGroup = groups.some(group =>
|
||||||
|
group.name === 'Админ ЭЖ' ||
|
||||||
|
(typeof group === 'string' && group.includes('Админ ЭЖ'))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hasSecretaryGroup) {
|
||||||
|
alert('Для задачи можно выбирать только пользователей из группы "администраторы электронного журнала"');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('title', title);
|
formData.append('title', title);
|
||||||
formData.append('description', description);
|
formData.append('description', description);
|
||||||
|
|||||||
@@ -729,9 +729,15 @@ app.get('/doc', (req, res) => {
|
|||||||
if (!req.session.user) {
|
if (!req.session.user) {
|
||||||
return res.redirect('/');
|
return res.redirect('/');
|
||||||
}
|
}
|
||||||
if (!req.session.user || req.session.user.role !== 'admin') {
|
const { role, name } = req.session.user;
|
||||||
|
const hasAccess = role === 'admin' || role === 'tasks';
|
||||||
|
|
||||||
|
if (!hasAccess) {
|
||||||
return res.status(403).send('в разработке');
|
return res.status(403).send('в разработке');
|
||||||
}
|
}
|
||||||
|
//if (!req.session.user || req.session.user.role !== 'admin') {
|
||||||
|
// return res.status(403).send('в разработке');
|
||||||
|
//}
|
||||||
res.sendFile(path.join(__dirname, 'public/doc.html'));
|
res.sendFile(path.join(__dirname, 'public/doc.html'));
|
||||||
});
|
});
|
||||||
// Страница поддержка
|
// Страница поддержка
|
||||||
|
|||||||
Reference in New Issue
Block a user