mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
GUI.Тип ошибки авторизации
This commit is contained in:
@@ -37,16 +37,32 @@ bool InterfaceDataBaseLMS::DBisConnected()
|
||||
|
||||
//Инструкторы
|
||||
|
||||
bool InterfaceDataBaseLMS::authorizationInstructor(QString login, QString password)
|
||||
bool InterfaceDataBaseLMS::authorizationInstructor(QString login, QString password, ErrorAuth& error)
|
||||
{
|
||||
error = ErrorAuth::errNo;
|
||||
|
||||
if(int id = selectUserID(DataBaseLMS::TypeUserDBInstructor, login, password))
|
||||
{
|
||||
if(selectUserArchived(DataBaseLMS::TypeUserDBInstructor, id) || selectUserLoggedIn(DataBaseLMS::TypeUserDBInstructor, id))
|
||||
if(selectUserArchived(DataBaseLMS::TypeUserDBInstructor, id))
|
||||
{
|
||||
error = ErrorAuth::errArchived;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(selectUserLoggedIn(DataBaseLMS::TypeUserDBInstructor, id))
|
||||
{
|
||||
error = ErrorAuth::errAlreadyLogIn;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(updateUserLoggedIn(DataBaseLMS::TypeUserDBInstructor, id, true))
|
||||
return true;
|
||||
else
|
||||
error = ErrorAuth::errDB;
|
||||
}
|
||||
else
|
||||
error = ErrorAuth::errLoginOrPassword;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -118,16 +134,32 @@ bool InterfaceDataBaseLMS::isLoggedInInstructor(int id)
|
||||
|
||||
//Инструкторы
|
||||
|
||||
bool InterfaceDataBaseLMS::authorizationTrainee(QString login, QString password, QString classroom_name, QString computer_name)
|
||||
bool InterfaceDataBaseLMS::authorizationTrainee(QString login, QString password, ErrorAuth& error, QString classroom_name, QString computer_name)
|
||||
{
|
||||
error = ErrorAuth::errNo;
|
||||
|
||||
if(int id = selectUserID(DataBaseLMS::TypeUserDBTrainee, login, password))
|
||||
{
|
||||
if(selectUserArchived(DataBaseLMS::TypeUserDBTrainee, id) || selectUserLoggedIn(DataBaseLMS::TypeUserDBTrainee, id))
|
||||
if(selectUserArchived(DataBaseLMS::TypeUserDBTrainee, id))
|
||||
{
|
||||
error = ErrorAuth::errArchived;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(selectUserLoggedIn(DataBaseLMS::TypeUserDBTrainee, id))
|
||||
{
|
||||
error = ErrorAuth::errAlreadyLogIn;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(updateUserLoggedIn(DataBaseLMS::TypeUserDBTrainee, id, true))
|
||||
return true;
|
||||
else
|
||||
error = ErrorAuth::errDB;
|
||||
}
|
||||
else
|
||||
error = ErrorAuth::errLoginOrPassword;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,15 @@
|
||||
|
||||
class DATABASELMS_EXPORT InterfaceDataBaseLMS : public DataBaseLMS
|
||||
{
|
||||
public:
|
||||
enum ErrorAuth
|
||||
{
|
||||
errNo = 0,
|
||||
errDB,
|
||||
errLoginOrPassword,
|
||||
errArchived,
|
||||
errAlreadyLogIn
|
||||
};
|
||||
public:
|
||||
InterfaceDataBaseLMS(QWidget *ownerWidget, QObject *parent = nullptr);
|
||||
|
||||
@@ -22,7 +31,7 @@ public:
|
||||
|
||||
//Инструкторы
|
||||
|
||||
bool authorizationInstructor(QString login, QString password);
|
||||
bool authorizationInstructor(QString login, QString password, ErrorAuth& error);
|
||||
bool deAuthorizationInstructor(QString login);
|
||||
bool deAuthorizationAllInstructors();
|
||||
|
||||
@@ -43,7 +52,7 @@ public:
|
||||
|
||||
//Обучаемые
|
||||
|
||||
bool authorizationTrainee(QString login, QString password, QString classroom_name, QString computer_name);
|
||||
bool authorizationTrainee(QString login, QString password, ErrorAuth& error, QString classroom_name, QString computer_name);
|
||||
bool deAuthorizationTrainee(QString login);
|
||||
bool deAuthorizationAllTrainees();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user