Блокировка Авторизации при Редактировании в ГУИ

This commit is contained in:
2025-10-02 18:36:41 +03:00
parent 05d4e02d02
commit a70c8b5be1
14 changed files with 75 additions and 9 deletions

View File

@@ -263,6 +263,24 @@ QByteArray DataParser::createDeAuthMessage(ClientDeAutorization *deAuth)
return array;
}
QByteArray DataParser::createQueryBlockAuth(bool block)
{
QByteArray array;
QXmlStreamWriter xmlWriter(&array);
xmlWriter.setAutoFormatting(true);
xmlWriter.writeStartDocument();
xmlWriter.writeStartElement("BlockAuth");
xmlWriter.writeAttribute("Block", block ? "1" : "0");
xmlWriter.writeEndElement();
xmlWriter.writeEndElement();
xmlWriter.writeEndDocument();
return array;
}
void DataParser::createServerSettings(QString address, QString port)

View File

@@ -28,6 +28,8 @@ public:
QByteArray createQueryTasksXMLMessage(QString type);
QByteArray createDeAuthMessage(ClientDeAutorization *deAuth);
QByteArray createQueryBlockAuth(bool block);
void createAuthData(ServerAuthorization *serverAuth);
void createAuthDataOffline(QString username,QString pass);
void addRunData(QList<int> displays);

View File

@@ -113,6 +113,19 @@ bool ConnectorToServer::sendQueryTasksXML(QString type)
return true;
}
bool ConnectorToServer::sendQueryBlockAuth(bool block)
{
if (!client->getIsConnected())
{
return false;
}
QByteArray array = dataParser->createQueryBlockAuth(block);
emit sigSendAnswerToServer(array);
return true;
}
void ConnectorToServer::setLoginName(QString name)
{
versionSelectWidget->setAuthor(name);

View File

@@ -30,6 +30,7 @@ public:
bool sendMessage(ClientMessage clientMessage);
bool sendQueryTasksXML(QString type);
bool sendQueryBlockAuth(bool block);
void SetConnectToServer();
void StopConnectToServer();

View File

@@ -58,7 +58,7 @@ void ViewerInstructors::changeEvent(QEvent *event)
void ViewerInstructors::on_btnEditorInstructors_clicked()
{
Q_EMIT signal_BlockAutorization(true);
connectorToServer->sendQueryBlockAuth(true);
dlgRedactor = new DialogRedactorInstructors(connectorToServer, adminMode, this);
dlgRedactor->exec();
@@ -72,7 +72,7 @@ void ViewerInstructors::on_btnEditorInstructors_clicked()
if(authComplited)
loadInstructorsFromDB();
Q_EMIT signal_BlockAutorization(false);
connectorToServer->sendQueryBlockAuth(false);
}
void ViewerInstructors::on_treeWidgetItemClicked(QTreeWidgetItem *item, int column)

View File

@@ -28,7 +28,7 @@ protected:
Q_SIGNALS:
//сигнал о блокировке авторизации
void signal_BlockAutorization(bool block);
//void signal_BlockAutorization(bool block);
public Q_SLOTS:
void on_btnEditorInstructors_clicked();

View File

@@ -48,8 +48,8 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
viewerInstructors = new ViewerInstructors(connectorToServer, this);
connect(this, &InstructorsAndTraineesWidget::signal_NeedUpdateUI, viewerTrainees, &ViewerTrainees::slot_NeedUpdateUI);
connect(this, &InstructorsAndTraineesWidget::signal_NeedUpdateUI, viewerInstructors, &ViewerInstructors::slot_NeedUpdateUI);
connect(viewerInstructors, &ViewerInstructors::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
connect(viewerTrainees, &ViewerTrainees::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
//connect(viewerInstructors, &ViewerInstructors::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
//connect(viewerTrainees, &ViewerTrainees::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
connect(connectorToServer, &ConnectorToServer::signal_ConnectedToServer, this, &InstructorsAndTraineesWidget::slot_ConnectedToServer);

View File

@@ -60,7 +60,7 @@ Q_SIGNALS:
//сигнал о необходимости обновления интерфейса
void signal_NeedUpdateUI(bool treeInstructor, bool treeTrainee);
//сигнал о блокировке авторизации
void signal_BlockAutorization(bool block);
//void signal_BlockAutorization(bool block);
private Q_SLOTS:
void on_btnConnectionToServer_clicked();

View File

@@ -92,7 +92,7 @@ void ViewerTrainees::changeEvent(QEvent *event)
void ViewerTrainees::on_btnEditorTrainees_clicked()
{
Q_EMIT signal_BlockAutorization(true);
connectorToServer->sendQueryBlockAuth(true);
dlgRedactor = new DialogRedactorTrainees(connectorToServer, adminMode, this);
dlgRedactor->exec();
@@ -106,7 +106,7 @@ void ViewerTrainees::on_btnEditorTrainees_clicked()
if(authComplited)
loadTraineesFromDB();
Q_EMIT signal_BlockAutorization(false);
connectorToServer->sendQueryBlockAuth(false);
}
void ViewerTrainees::on_itemDoubleClicked(QTreeWidgetItem *item, int column)

View File

@@ -32,7 +32,7 @@ protected:
Q_SIGNALS:
//сигнал о блокировке авторизации
void signal_BlockAutorization(bool block);
//void signal_BlockAutorization(bool block);
public Q_SLOTS:
//void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column);