отклонение запроса на Управление версиями

This commit is contained in:
2026-01-22 15:18:40 +03:00
parent 2522bc6af5
commit 5415afe264
12 changed files with 156 additions and 16 deletions

View File

@@ -43,6 +43,20 @@ QByteArray ClientAnswerParser::deAuthorization(bool result, QString login)
return dataParser->xmlAnswer(listTag);
}
QByteArray ClientAnswerParser::tryBlock(bool result, QString type)
{
QList<SXmlAnswerTag> listTag;
SAttribute attribute1 = {"Result", result? "true" : "false"};
SAttribute attribute2 = {"Type", type};
QList<SAttribute> listAttr = {attribute1, attribute2};
SXmlAnswerTag tag = {"TryBlock", listAttr};
listTag.append(tag);
return dataParser->xmlAnswer(listTag);
}
QByteArray ClientAnswerParser::message(QString loginFrom,QString loginTo,QString text)
{
QList<SXmlAnswerTag> listTag;

View File

@@ -16,6 +16,7 @@ public:
QByteArray authorization(bool result, QString instructorName, QString clientName, QString accessType, QString login, int id);
QByteArray deAuthorization(bool result, QString login);
QByteArray tryBlock(bool result, QString type);
QByteArray message(QString loginFrom,QString loginTo,QString text);
QByteArray task(QString text);
QByteArray notify(QString code);

View File

@@ -188,7 +188,19 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
void ProcessingSystem::processingClientBlockAuth(ClientHandler *client, bool block, QString type)
{
QByteArray arrayAnswer;
bool res = emit providerDBLMS->signal_BlockAutorization(block, client->getClient()->getFullName(), type);
if(res)
{//Блокировка одобрена
arrayAnswer = dataParser->ClientAnswer()->tryBlock(true, type);
}
else
{//Отказ
arrayAnswer = dataParser->ClientAnswer()->tryBlock(false, type);
}
client->sendXmlAnswer(arrayAnswer);
}
//упращенная деавторизация при выключении сервера

View File

@@ -149,16 +149,50 @@ void MultiThreadServer::slotDisconnectClient(QString peerAddress, QString peerPo
bool MultiThreadServer::slot_BlockAutorization(bool block, QString whoFullName, QString type)
{
bool res = true;
bool res = false;
bool blockRes = false;
QString key = whoFullName + " [type:" + type + "]";
QString strTypes = "";
if(block)
{
this->blockAutorization();
blockersMap.insert(key, type);
blockRes = true;
if(whoFullName == "SERVER")
{
this->blockAutorization();
blockersMap.insert(key, type);
blockRes = true;
res = true;
}
else
{
bool flExist = false;
foreach(QString keyLocal, blockersMap.keys())
{
if(blockersMap[keyLocal] == type)
{
flExist = true;
break;
}
}
if(!flExist)
{
this->blockAutorization();
blockersMap.insert(key, type);
blockRes = true;
res = true;
}
else
{
if(!blockersMap.count())
blockRes = false;
else
blockRes = true;
res = false;
}
}
}
else
{
@@ -170,6 +204,8 @@ bool MultiThreadServer::slot_BlockAutorization(bool block, QString whoFullName,
}
else
blockRes = true;
res = true;
}
if(res)