Контроль целостности логинов юзеров

This commit is contained in:
2025-08-18 17:19:29 +03:00
parent ef12d4f7a9
commit 037390a9c7
11 changed files with 150 additions and 155 deletions

View File

@@ -404,7 +404,7 @@ int DataBaseLMS::deleteTaskFIM(int id_task)
report_id = queryReportsSEL.value(0).toInt();
}
}
if(!report_id)
else
{
resBool = db->rollback();
return 0;

View File

@@ -267,8 +267,8 @@ int DataBaseLMS::deleteTrainee(int id_trainee)
int mulf_id = queryMulfSEL.value(0).toInt();
/*Удаление сигналов для этой неисправности*/
queryStr = QString("DELETE FROM public.mals_signs "
"WHERE mals_signs.fk_mulfunction_id = %1 ").arg(
queryStr = QString("DELETE FROM public.malf_signs "
"WHERE malf_signs.fk_malfunction_id = %1 ").arg(
mulf_id);
QSqlQuery querySign = QSqlQuery(*db);
if(!queryExec(queryStr, &querySign))

View File

@@ -123,37 +123,6 @@ int InterfaceDataBaseLMS::delInstructor(int id)
int InterfaceDataBaseLMS::editInstructor(Instructor instructor)
{
//QMutexLocker mtxLocker(&mtxAccess);
//Проверка корректности логина, имени, пароля
if(instructor.getName() == QStringLiteral("<name>"))
{//Имя не корректно!
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("Unacceptable instructor name has been entered.\nThe changes will not be accepted."));
return 0;
}
if(instructor.getLogin() == QStringLiteral("<login>"))
{//Логин не корректен!
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("Unacceptable instructor login has been entered.\nThe changes will not be accepted."));
return 0;
}
if(instructor.getPassword() == QStringLiteral("<password>"))
{//Пароль не корректный!
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("Unacceptable instructor password has been entered.\nThe changes will not be accepted."));
return 0;
}
if(selectUserID(DataBaseLMS::TypeUserDBInstructor, instructor.getLogin()) || selectUserID(DataBaseLMS::TypeUserDBTrainee, instructor.getLogin()))
{//Логин уже существует!
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted."));
return 0;
}
return updateInstructor(instructor);
}
@@ -324,26 +293,6 @@ int InterfaceDataBaseLMS::delGroup(int id)
int InterfaceDataBaseLMS::editGroup(Group group)
{
//QMutexLocker mtxLocker(&mtxAccess);
//Проверка корректности имени
QList<Group> listGroups = selectAllGroups();
for(Group exist_group : listGroups)
{
if(group.getName() == QStringLiteral("<group>"))
{//Имя не корректно!
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("Unacceptable group name has been entered.\nThe changes will not be accepted."));
return 0;
}
if(group.getName() == exist_group.getName() && group.getID() != exist_group.getID())
{//Имя уже существует
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("An existing group name has been entered.\nThe changes will not be accepted."));
return 0;
}
}
return updateGroup(group);
}
@@ -440,37 +389,6 @@ int InterfaceDataBaseLMS::delTrainee(int id)
int InterfaceDataBaseLMS::editTrainee(Trainee trainee)
{
//QMutexLocker mtxLocker(&mtxAccess);
//Проверка корректности логина, имени, пароля
if(trainee.getName() == QStringLiteral("<trainee>"))
{//Имя не корректно!
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("Unacceptable trainee name has been entered.\nThe changes will not be accepted."));
return 0;
}
if(trainee.getLogin() == QStringLiteral("<login>"))
{//Логин не корректен!
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("Unacceptable trainee login has been entered.\nThe changes will not be accepted."));
return 0;
}
if(trainee.getPassword() == QStringLiteral("<password>"))
{//Пароль не корректный!
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("Unacceptable trainee password has been entered.\nThe changes will not be accepted."));
return 0;
}
if(selectUserID(DataBaseLMS::TypeUserDBInstructor, trainee.getLogin()) || selectUserID(DataBaseLMS::TypeUserDBTrainee, trainee.getLogin()))
{//Логин уже существует!
QMessageBox::critical(ownerWidget, tr("Editing error!"),
tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted."));
return 0;
}
return updateTrainee(trainee);
}