карта блок-в. Блокировка правильная. Множ. доступ

This commit is contained in:
2026-01-21 15:44:01 +03:00
parent fe75f2c6ca
commit 2772c3aaba
26 changed files with 146 additions and 91 deletions

View File

@@ -367,6 +367,7 @@ void ProcessParser::clientDeAuth(QXmlStreamReader &xmlReader,ClientHandler *clie
void ProcessParser::clientBlockAuth(QXmlStreamReader &xmlReader, ClientHandler *client)
{
bool block = false;
QString type = "";
/*Перебираем все атрибуты тега*/
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
@@ -377,9 +378,12 @@ void ProcessParser::clientBlockAuth(QXmlStreamReader &xmlReader, ClientHandler *
if(name == "Block")
block = (value == "1") ? true : false;
if(name == "type")
type = value;
}
processingSystem->processingClientBlockAuth(client, block);
processingSystem->processingClientBlockAuth(client, block, type);
}
void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array)

View File

@@ -117,7 +117,7 @@ void CommonClientHandler::slot_sendPacketToAllClients(PacketType packetType)
Logger::instance().log("AllSending " + handler->getClient()->getLogin() + " " + enumToString(packetType));
}
emit sigSetServerState(packetType);
//emit sigSetServerState(packetType);
}

View File

@@ -22,13 +22,17 @@ public:
void slot_ListsInstructorsTraineesChanged();
void slot_StatusTasksAMMofTraineeChanged(int trainee_id);
void slot_StatusTasksFIMofTraineeChanged(int trainee_id);
void slot_sendPacketToAllClients(PacketType packetType);
bool slotSendMessage(QString loginFrom, QString loginTo, QString text);
void slot_sendTaskToClient(QString fullNameClient, QString textTask);
void slot_DocsChanged();
public slots:
void slot_sendPacketToAllClients(PacketType packetType);
signals:
void sigSetServerState(PacketType packetType);
//void sigSetServerState(PacketType packetType);
private:
QMap<int, ClientHandler*> *clientsMap;
ProcessingSystem *processingSystem;

View File

@@ -164,6 +164,8 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
else if(providerDBLMS->deAuthorizationInstructor(clientDeAutorization.Login))
{//ДеАвторизуется инструктор
QString fullName = client->getClient()->getFullName();
client->getClient()->setLogin("");
client->getClient()->setAccessType(UserType::NONE);
client->getClient()->setIsLoggedIn(false);
@@ -172,6 +174,8 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
arrayAnswer = dataParser->ClientAnswer()->deAuthorization(true, clientDeAutorization.Login);
client->sendXmlAnswer(arrayAnswer);
providerDBLMS->signal_BlockAutorization(false, fullName, "DeAuthorizationInstructor");
//Извещаем об изменениях в авторизации
emit sigListsInstructorsTraineesChanged();
}
@@ -182,9 +186,9 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
}
}
void ProcessingSystem::processingClientBlockAuth(ClientHandler *client, bool block)
void ProcessingSystem::processingClientBlockAuth(ClientHandler *client, bool block, QString type)
{
emit providerDBLMS->signal_BlockAutorization(block);
bool res = emit providerDBLMS->signal_BlockAutorization(block, client->getClient()->getFullName(), type);
}
//упращенная деавторизация при выключении сервера

View File

@@ -35,7 +35,7 @@ public:
void processingClientAutorization(ClientHandler *client, ClientAutorization clientAutorization);
void processingClientDeAutorization(ClientHandler *client, ClientDeAutorization clientDeAutorization);
void processingClientBlockAuth(ClientHandler *client, bool block);
void processingClientBlockAuth(ClientHandler *client, bool block, QString type);
void processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id = 0, void* data = nullptr);
void processingClientQueryTasksXML(ClientHandler *client, ClientQueryTasksXML clientQueryTasksXML);
void processingClientQueryListSubProc(ClientHandler *client, QString dmCode);

View File

@@ -411,7 +411,7 @@ void RecognizeSystem::recognize()
}
emit sigCopyVersion(result[0],result[1],result[2]);
sendSystem->sendPacketType(PacketType::BUSY);
//sendSystem->sendPacketType(PacketType::BUSY); //KAV Вроде, это не нужно (дублируется)?
}
if(packetType == PacketType::DELETE_DATA_VERSION)

View File

@@ -44,7 +44,7 @@ void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataP
void UpdateController::changeAssetVersion(QString versionName)
{
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
//commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
qDebug() << "UpdateController thread ID " << QThread::currentThreadId();
currentStreamingPath = assetManager->setVersion(versionName);
setUpCurrentServerHash();
@@ -52,21 +52,21 @@ void UpdateController::changeAssetVersion(QString versionName)
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY);
commonClientHandler->sendCurrentVersionToAllClient();
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
//commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
}
void UpdateController::createCopyVersion(QString versionName,QString newVersionName,QString author)
{
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
//commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
assetManager->createCopyVersion(versionName,newVersionName,author);
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
//commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
}
void UpdateController::deleteAssetVersion(QString versionName)
{
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
//commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
assetManager->deleteVersion(versionName);
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
//commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
}
void UpdateController::compareFiles(ClientHandler* handler, QByteArray array)
@@ -94,7 +94,8 @@ void UpdateController::calculateFullHash()
QElapsedTimer timer;
timer.start();
qDebug() << "Start calculate... ";
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
//commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
bool res = emit signal_BlockAutorization(true, "SERVER", "CalculateFullHash");
//auto *list = calculateHash(buildPath);
hashCalculator->calculateHashes(buildPath);
@@ -104,8 +105,8 @@ void UpdateController::calculateFullHash()
calculateSharedHash();
Logger::instance().log("Calculate hash complete");
qDebug() << "Calculate time " << timer.elapsed();
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
//commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
res = emit signal_BlockAutorization(false, "SERVER", "CalculateFullHash");
}
void UpdateController::calculateFullHashWithSetup()

View File

@@ -71,6 +71,9 @@ signals:
void sigInitializeFinished();
//сигнал о блокировке авторизации
bool signal_BlockAutorization(bool block, QString whoFullName, QString type);
private:
QList<FileData> clientDataList;
QList<FileData> serverDataList;