From 4a7255a03ee7fd6e50ac83eb008e276806646299 Mon Sep 17 00:00:00 2001 From: kambizzandi Date: Thu, 11 Aug 2022 00:01:46 +0430 Subject: [PATCH] fix in save i18n fields --- Interfaces/AAA/Accounting_Interfaces.cpp | 8 +- Interfaces/AAA/PrivHelpers.cpp | 6 +- Interfaces/AAA/clsJWT.hpp | 45 +++--- Interfaces/AAA/intfAccountingBasedModule.cpp | 12 +- Interfaces/API/intfSQLBasedModule.cpp | 88 +++++----- .../ObjectStorage/ObjectStorageManager.cpp | 8 +- Interfaces/Server/APICallBoom.cpp | 10 +- Interfaces/Server/APICallBoom.h | 2 +- Modules/Account/functionalTest/ORM/tokens.hpp | 10 +- .../Account/functionalTest/testAccount.hpp | 4 +- Modules/Account/moduleSrc/Account.cpp | 38 ++--- .../moduleSrc/ORM/APITokenValidIPs.cpp | 10 +- Modules/Account/moduleSrc/ORM/APITokens.cpp | 8 +- .../Account/moduleSrc/ORM/ActiveSessions.cpp | 6 +- Modules/Account/moduleSrc/ORM/Currency.cpp | 2 +- Modules/Account/moduleSrc/ORM/Payments.cpp | 14 +- Modules/Account/moduleSrc/ORM/User.cpp | 22 +-- Modules/Account/moduleSrc/ORM/UserWallets.cpp | 24 +-- Modules/Account/moduleSrc/ORM/Voucher.cpp | 6 +- .../moduleSrc/ORM/WalletTransactions.cpp | 2 +- Modules/Advert/functionalTest/testAdvert.hpp | 8 +- .../functionalTest/testAdvertFixture.hpp | 4 +- .../db/m20220810_232558_Advert_remove_ex.sql | 39 +++++ Modules/Advert/moduleSrc/Advert.cpp | 10 +- Modules/Advert/moduleSrc/ORM/Accounting.h | 150 +++++++++--------- Modules/Advert/moduleSrc/ORM/Clicks.cpp | 2 +- Modules/Advert/moduleSrc/ORM/Props.cpp | 14 +- .../functionalTest/testTicketing.hpp | 4 +- .../functionalTest/testTicketingFixture.hpp | 4 +- .../moduleSrc/ORM/TicketAttachments.cpp | 8 +- Modules/Ticketing/moduleSrc/ORM/Tickets.cpp | 4 +- Modules/Ticketing/moduleSrc/Ticketing.cpp | 6 +- 32 files changed, 313 insertions(+), 265 deletions(-) create mode 100644 Modules/Advert/migrations/db/m20220810_232558_Advert_remove_ex.sql diff --git a/Interfaces/AAA/Accounting_Interfaces.cpp b/Interfaces/AAA/Accounting_Interfaces.cpp index c856b5db..3b808ba4 100644 --- a/Interfaces/AAA/Accounting_Interfaces.cpp +++ b/Interfaces/AAA/Accounting_Interfaces.cpp @@ -670,7 +670,7 @@ ORMSelectQuery intfAccountUserAssets::makeSelectQuery(INTFAPICALLBOOM_IMPL &APIC QVariant IMPL_ORMGET(intfAccountUserAssets) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblAccountUserAssetsBase::Fields::uas_usrID, APICALLBOOM_PARAM.getUserID() }}, _filters); + this->setSelfFilters({{tblAccountUserAssetsBase::Fields::uas_usrID, APICALLBOOM_PARAM.getActorID() }}, _filters); return this->Select(GET_METHOD_ARGS_CALL_VALUES); } @@ -686,7 +686,7 @@ bool IMPL_REST_UPDATE(intfAccountUserAssets, setAsPrefered, ( this->callSP(APICALLBOOM_PARAM, "spUserAsset_SetAsPrefered", { - { "iUserID", APICALLBOOM_PARAM.getUserID() }, + { "iUserID", APICALLBOOM_PARAM.getActorID() }, { "iUASID", UserPackageID }, }); return false; @@ -702,7 +702,7 @@ bool IMPL_REST_UPDATE(intfAccountUserAssets, disablePackage, ( throw exHTTPBadRequest("Invalid UserPackageID provided"); Authorization::checkPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_PATCH, this->moduleBaseName())); - /*return this->update(APICALLBOOM_PARAM.getUserID(), { + /*return this->update(APICALLBOOM_PARAM.getActorID(), { {tblAccountUserAssets::Fields::uasID, UserPackageID} }, { {tblAccountUserAssets::Fields::uasStatus, TAPI::enuAuditableStatus::Banned}, @@ -755,7 +755,7 @@ intfAccountAssetUsage::intfAccountAssetUsage( QVariant IMPL_ORMGET(intfAccountAssetUsage) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblAccountUserAssetsBase::Fields::uas_usrID, APICALLBOOM_PARAM.getUserID()}}, _filters); + this->setSelfFilters({{tblAccountUserAssetsBase::Fields::uas_usrID, APICALLBOOM_PARAM.getActorID()}}, _filters); return this->Select(GET_METHOD_ARGS_CALL_VALUES); } diff --git a/Interfaces/AAA/PrivHelpers.cpp b/Interfaces/AAA/PrivHelpers.cpp index a14db540..dad603f9 100644 --- a/Interfaces/AAA/PrivHelpers.cpp +++ b/Interfaces/AAA/PrivHelpers.cpp @@ -161,9 +161,9 @@ QVariant PrivHelpers::getPrivValue(const QJsonObject& _privs, const QString& _se } stuActiveAccount PrivHelpers::processUserObject( - QJsonObject& _userObj, - const QStringList& _requiredAccess, - const QStringList& _services + QJsonObject& _userObj, + const QStringList& _requiredAccess, + const QStringList& _services ) { if (_userObj.contains(DBM_SPRESULT_ROWS)) _userObj = _userObj[DBM_SPRESULT_ROWS].toArray().at(0).toObject(); diff --git a/Interfaces/AAA/clsJWT.hpp b/Interfaces/AAA/clsJWT.hpp index 8b25a10b..a24d03ab 100644 --- a/Interfaces/AAA/clsJWT.hpp +++ b/Interfaces/AAA/clsJWT.hpp @@ -31,16 +31,18 @@ namespace Targoman::API::AAA { -namespace JWTItems{ +namespace JWTItems { +TARGOMAN_CREATE_CONSTEXPR(jti); TARGOMAN_CREATE_CONSTEXPR(iat); TARGOMAN_CREATE_CONSTEXPR(exp); -TARGOMAN_CREATE_CONSTEXPR(jti); +// +TARGOMAN_CREATE_CONSTEXPR(uid); //usrID -> actor id +// TARGOMAN_CREATE_CONSTEXPR(priv); TARGOMAN_CREATE_CONSTEXPR(privs); TARGOMAN_CREATE_CONSTEXPR(usrLogin); TARGOMAN_CREATE_CONSTEXPR(usrName); TARGOMAN_CREATE_CONSTEXPR(usrFamily); -TARGOMAN_CREATE_CONSTEXPR(usrID); TARGOMAN_CREATE_CONSTEXPR(usrApproval); TARGOMAN_CREATE_CONSTEXPR(usrStatus); TARGOMAN_CREATE_CONSTEXPR(canChangePass); @@ -48,25 +50,28 @@ TARGOMAN_CREATE_CONSTEXPR(rolID); TARGOMAN_CREATE_CONSTEXPR(rolName); } -class clsJWT{ +class clsJWT { public: clsJWT(const QJsonObject& _token) : Token(_token) { ; } - inline QString login() const {return this->Token.value(JWTItems::usrLogin).toString();} - inline QString name() const {return this->Token.value(JWTItems::usrName).toString();} - inline QString family() const {return this->Token.value(JWTItems::usrFamily).toString();} - inline QString rolName() const {return this->Token.value(JWTItems::rolName).toString();} - inline quint64 rolID() const {return static_cast(this->Token.value(JWTItems::rolID).toDouble());} - inline QVariantMap privs() const {return this->Token.value(JWTItems::privs).toObject().toVariantMap();} - inline QJsonObject privsObject() const {return this->Token.value(JWTItems::privs).toObject();} - inline quint64 usrID() const {return static_cast(this->Token.value(JWTItems::usrID).toDouble());} - inline TAPI::enuUserApproval::Type usrApproval() const {return TAPI::enuUserApproval::toEnum(this->Token.value(JWTItems::usrApproval).toString().toLatin1().constData());} - inline TAPI::enuUserStatus::Type usrStatus() const {return TAPI::enuUserStatus::toEnum(this->Token.value(JWTItems::usrStatus).toString().toLatin1().constData());} - inline QString session() const {return this->Token.value(JWTItems::jti).toString();} - inline QVariantMap privatePart() const {return this->Token.value(JWTItems::priv).toObject().toVariantMap();} - inline QJsonValue value(const QLatin1String& _key) const {return this->Token.value(_key);} - inline bool canChangePass() const {return this->Token.value(JWTItems::canChangePass).toBool();} - inline quint64 issuedAt() const { return static_cast(this->Token.value(JWTItems::iat).toDouble()); } - inline quint64 expireAt() const { return static_cast(this->Token.value(JWTItems::exp).toDouble()); } + inline QString session() const { return this->Token.value(JWTItems::jti).toString(); } + inline quint64 issuedAt() const { return static_cast(this->Token.value(JWTItems::iat).toDouble()); } + inline quint64 expireAt() const { return static_cast(this->Token.value(JWTItems::exp).toDouble()); } + // + inline quint64 actorID() const { return static_cast(this->Token.value(JWTItems::uid).toDouble()); } + // + inline QVariantMap privatePart() const { return this->Token.value(JWTItems::priv).toObject().toVariantMap(); } + inline QVariantMap privs() const { return this->Token.value(JWTItems::privs).toObject().toVariantMap(); } + inline QJsonObject privsObject() const { return this->Token.value(JWTItems::privs).toObject(); } + inline QString login() const { return this->Token.value(JWTItems::usrLogin).toString(); } + inline QString name() const { return this->Token.value(JWTItems::usrName).toString(); } + inline QString family() const { return this->Token.value(JWTItems::usrFamily).toString(); } + inline TAPI::enuUserApproval::Type usrApproval() const { return TAPI::enuUserApproval::toEnum(this->Token.value(JWTItems::usrApproval).toString().toLatin1().constData()); } + inline TAPI::enuUserStatus::Type usrStatus() const { return TAPI::enuUserStatus::toEnum(this->Token.value(JWTItems::usrStatus).toString().toLatin1().constData()); } + inline bool canChangePass() const { return this->Token.value(JWTItems::canChangePass).toBool(); } + inline QString rolName() const { return this->Token.value(JWTItems::rolName).toString(); } + inline quint64 rolID() const { return static_cast(this->Token.value(JWTItems::rolID).toDouble()); } + + inline QJsonValue value(const QLatin1String& _key) const { return this->Token.value(_key); } /** * @brief createSignedJWT creates an string containing HEADER.PAYLOAD.SIGNATURE as described by JWT standard. diff --git a/Interfaces/AAA/intfAccountingBasedModule.cpp b/Interfaces/AAA/intfAccountingBasedModule.cpp index 40d38f31..2a3c0eee 100644 --- a/Interfaces/AAA/intfAccountingBasedModule.cpp +++ b/Interfaces/AAA/intfAccountingBasedModule.cpp @@ -171,7 +171,7 @@ void intfAccountingBasedModule::checkUsageIsAllowed( if (Privs.contains(this->ServiceName) == false) throw exHTTPForbidden("[81] You don't have access to: " + this->ServiceName); - stuActiveCredit BestMatchedCredit = this->findBestMatchedCredit(APICALLBOOM_PARAM.getUserID(), _requestedUsage); + stuActiveCredit BestMatchedCredit = this->findBestMatchedCredit(APICALLBOOM_PARAM.getActorID(), _requestedUsage); if (BestMatchedCredit.TTL == 0) ///@TODO: TTL must be checked throw exHTTPForbidden("[82] You don't have access to: " + this->ServiceName); @@ -377,7 +377,7 @@ Targoman::API::AAA::stuBasketActionResult IMPL_REST_POST(intfAccountingBasedModu //-- validate preVoucher and owner -------------------------------- checkPreVoucherSanity(_lastPreVoucher); - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); if (_lastPreVoucher.Items.isEmpty()) _lastPreVoucher.UserID = CurrentUserID; @@ -721,7 +721,7 @@ Targoman::API::AAA::stuBasketActionResult intfAccountingBasedModule::internalUpd //-- validate preVoucher and owner -------------------------------- checkPreVoucherSanity(_lastPreVoucher); - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); if (_lastPreVoucher.Items.isEmpty()) throw exHTTPBadRequest("Pre-Voucher is empty"); @@ -934,7 +934,7 @@ void intfAccountingBasedModule::processItemForBasket( **/ //-- -------------------------------- - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); //-- -------------------------------- if ((_oldVoucherItem == nullptr) && (_assetItem.Qty == 0)) @@ -1112,7 +1112,7 @@ void intfAccountingBasedModule::computeCouponDiscount( INOUT stuAssetItem &_assetItem, const stuVoucherItem *_oldVoucherItem /*= nullptr*/ ) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); /** * discount code: @@ -1474,7 +1474,7 @@ bool intfAccountingBasedModule::cancelVoucherItem( this->AccountSaleables->callSP(APICALLBOOM_PARAM, "spSaleable_unReserve", { { "iSaleableID", SaleableID }, - { "iUserID", APICALLBOOM_PARAM.getUserID() }, + { "iUserID", APICALLBOOM_PARAM.getActorID() }, { "iQty", _voucherItem.Qty }, }); diff --git a/Interfaces/API/intfSQLBasedModule.cpp b/Interfaces/API/intfSQLBasedModule.cpp index 0549b619..726fecd3 100644 --- a/Interfaces/API/intfSQLBasedModule.cpp +++ b/Interfaces/API/intfSQLBasedModule.cpp @@ -252,33 +252,35 @@ quint64 intfSQLBasedModule::Create( this->prepareFiltersList(); - TAPI::ORMFields_t CreateInfo; +// TAPI::ORMFields_t CreateInfo; //key: language QMap I18NCreateInfo; //1: extract I18N fields - TAPI::ORMFields_t::iterator it = _createInfo.begin(); - while (it != _createInfo.end()) { - if (it.key().endsWith("I18N")) { - QString ColName = it.key().chopped(QString("I18N").length()); - - QVariantMap ValuesByLanguage = it.value().toMap(); - it = _createInfo.erase(it); - - IteratorHelper::ConstIterator(ValuesByLanguage) - .runAll([&ColName, &I18NCreateInfo](QString _key, QVariant _value) -> bool { - I18NCreateInfo[_key].insert(ColName, _value); - return true; - }); + if (this->name().endsWith("I18N") == false) { + TAPI::ORMFields_t::iterator it = _createInfo.begin(); + while (it != _createInfo.end()) { + if (it.key().endsWith("I18N")) { + QString ColName = it.key(); //.chopped(QString("I18N").length()); + + QVariantMap ValuesByLanguage = it.value().toMap(); + it = _createInfo.erase(it); + + IteratorHelper::ConstIterator(ValuesByLanguage) + .runAll([&ColName, &I18NCreateInfo](QString _key, QVariant _value) -> bool { + I18NCreateInfo[_key].insert(ColName, _value); + return true; + }); + + continue; + } else + it++; + } - continue; - } else - it++; + if ((I18NCreateInfo.isEmpty() == false) && (clsTable::Registry.contains(this->nameWithSchema() + "I18N") == false)) + throw exHTTPBadRequest(QString("Table %1 cannot be translated").arg(this->nameWithSchema())); } - if ((I18NCreateInfo.isEmpty() == false) && (clsTable::Registry.contains(this->nameWithSchema() + "I18N") == false)) - throw exHTTPBadRequest(QString("Table %1 cannot be translated").arg(this->nameWithSchema())); - //2: run wo/ I18N ORMCreateQuery query = this->makeCreateQuery(APICALLBOOM_PARAM); @@ -287,7 +289,7 @@ quint64 intfSQLBasedModule::Create( query.values(_createInfo); - quint64 LastID = query.execute(APICALLBOOM_PARAM.getUserID(SYSTEM_USER_ID)); + quint64 LastID = query.execute(APICALLBOOM_PARAM.getActorID(SYSTEM_USER_ID)); //3: run I18N if ((LastID > 0) && (I18NCreateInfo.isEmpty() == false)) { @@ -333,33 +335,35 @@ bool intfSQLBasedModule::Update( if (_updateInfo.isEmpty()) throw exHTTPBadRequest("No change provided to update"); - TAPI::ORMFields_t UpdateInfo; +// TAPI::ORMFields_t UpdateInfo; //key: language QMap I18NUpdateInfo; //1: extract I18N fields TAPI::ORMFields_t::iterator it = _updateInfo.begin(); - while (it != _updateInfo.end()) { - if (it.key().endsWith("I18N")) { - QString ColName = it.key().chopped(QString("I18N").length()); - - QVariantMap ValuesByLanguage = it.value().toMap(); - it = _updateInfo.erase(it); - - IteratorHelper::ConstIterator(ValuesByLanguage) - .runAll([&ColName, &I18NUpdateInfo](QString _key, QVariant _value) -> bool { - I18NUpdateInfo[_key].insert(ColName, _value); - return true; - }); + if (this->name().endsWith("I18N") == false) { + while (it != _updateInfo.end()) { + if (it.key().endsWith("I18N")) { + QString ColName = it.key(); //.chopped(QString("I18N").length()); + + QVariantMap ValuesByLanguage = it.value().toMap(); + it = _updateInfo.erase(it); + + IteratorHelper::ConstIterator(ValuesByLanguage) + .runAll([&ColName, &I18NUpdateInfo](QString _key, QVariant _value) -> bool { + I18NUpdateInfo[_key].insert(ColName, _value); + return true; + }); + + continue; + } else + it++; + } - continue; - } else - it++; + if ((I18NUpdateInfo.isEmpty() == false) && (clsTable::Registry.contains(this->nameWithSchema() + "I18N") == false)) + throw exHTTPBadRequest(QString("Table %1 cannot be translated").arg(this->nameWithSchema())); } - if ((I18NUpdateInfo.isEmpty() == false) && (clsTable::Registry.contains(this->nameWithSchema() + "I18N") == false)) - throw exHTTPBadRequest(QString("Table %1 cannot be translated").arg(this->nameWithSchema())); - //2: run wo/ I18N ORMUpdateQuery query = this->makeUpdateQuery(APICALLBOOM_PARAM) .setPksByPath(_pksByPath) @@ -381,7 +385,7 @@ bool intfSQLBasedModule::Update( } } - quint64 NumRowsAffected = query.execute(APICALLBOOM_PARAM.getUserID(SYSTEM_USER_ID)) > 0; + quint64 NumRowsAffected = query.execute(APICALLBOOM_PARAM.getActorID(SYSTEM_USER_ID)) > 0; //3: run I18N if ((NumRowsAffected > 0) && (I18NUpdateInfo.isEmpty() == false)) { @@ -454,7 +458,7 @@ bool intfSQLBasedModule::DeleteByPks( query.andWhere({ relatedORMField.Col.name(), enuConditionOperator::Equal, FilterIter.value() }); } - return query.execute(APICALLBOOM_PARAM.getUserID(SYSTEM_USER_ID), {}, _realDelete) > 0; + return query.execute(APICALLBOOM_PARAM.getActorID(SYSTEM_USER_ID), {}, _realDelete) > 0; } } // namespace Targoman::API::API diff --git a/Interfaces/ObjectStorage/ObjectStorageManager.cpp b/Interfaces/ObjectStorage/ObjectStorageManager.cpp index 4fb7c171..fbca0f95 100644 --- a/Interfaces/ObjectStorage/ObjectStorageManager.cpp +++ b/Interfaces/ObjectStorage/ObjectStorageManager.cpp @@ -101,7 +101,7 @@ quint64 ObjectStorageManager::saveFile( throw exTargomanBase("Could not create storage folder.", ESTATUS_INTERNAL_SERVER_ERROR); } //-- - QString StrOwnerID = QString("user_%1").arg(APICALLBOOM_PARAM.getUserID()); + QString StrOwnerID = QString("user_%1").arg(APICALLBOOM_PARAM.getActorID()); if (FullPathDir.exists(StrOwnerID) == false) { if (FullPathDir.mkpath(StrOwnerID) == false) throw exTargomanBase("Could not create path under storage folder.", ESTATUS_INTERNAL_SERVER_ERROR); @@ -149,7 +149,7 @@ quint64 ObjectStorageManager::saveFile( { "iFileSize", _file.Size }, { "iFileType", FileType }, { "iMimeType", MimeType }, - { "iCreatorUserID", APICALLBOOM_PARAM.getUserID() }, + { "iCreatorUserID", APICALLBOOM_PARAM.getActorID() }, { "iLockedBy", ServerCommonConfigs::InstanceID.value() }, }) .spDirectOutputs(); @@ -185,7 +185,7 @@ quint64 ObjectStorageManager::saveFile( ObjectStorageManager::processQueue, stuProcessQueueParams( APICALLBOOM_PARAM, - APICALLBOOM_PARAM.getUserID(), + APICALLBOOM_PARAM.getActorID(), _uploadFiles, _uploadQueue, _uploadGateways, @@ -206,7 +206,7 @@ quint64 ObjectStorageManager::saveFile( .set(tblUploadQueue::Fields::uquLockedBy, DBExpression::NIL()) .where({ tblUploadQueue::Fields::uqu_uflID, enuConditionOperator::Equal, UploadedFileID }) .andWhere({ tblUploadQueue::Fields::uquLockedAt, enuConditionOperator::NotNull }) - .execute(APICALLBOOM_PARAM.getUserID()) + .execute(APICALLBOOM_PARAM.getActorID()) ; } diff --git a/Interfaces/Server/APICallBoom.cpp b/Interfaces/Server/APICallBoom.cpp index 10ccc1c0..1be38a1e 100644 --- a/Interfaces/Server/APICallBoom.cpp +++ b/Interfaces/Server/APICallBoom.cpp @@ -124,11 +124,11 @@ void intfAPICallBoom::setJWT(/*TAPI::JWT_t*/QJsonObject &_JWT) { /*TAPI::JWT_t*/QJsonObject &intfAPICallBoom::getJWT() { return this->Data->JWT; } -quint64 intfAPICallBoom::getUserID(quint64 _default) { - quint64 UserID = Targoman::API::AAA::clsJWT(this->Data->JWT).usrID(); - if (UserID == 0) - UserID = _default; - return UserID; +quint64 intfAPICallBoom::getActorID(quint64 _default) { + quint64 ActorID = Targoman::API::AAA::clsJWT(this->Data->JWT).actorID(); + if (ActorID == 0) + ActorID = _default; + return ActorID; } QJsonObject intfAPICallBoom::getJWTPrivsObject() { return Targoman::API::AAA::clsJWT(this->Data->JWT).privsObject(); diff --git a/Interfaces/Server/APICallBoom.h b/Interfaces/Server/APICallBoom.h index 8d428f73..686df515 100644 --- a/Interfaces/Server/APICallBoom.h +++ b/Interfaces/Server/APICallBoom.h @@ -81,7 +81,7 @@ class intfAPICallBoom virtual bool needJWT() = 0; void setJWT(/*TAPI::JWT_t*/QJsonObject &_JWT); /*TAPI::JWT_t*/QJsonObject &getJWT(); - quint64 getUserID(quint64 _default=0); + quint64 getActorID(quint64 _default=0); QJsonObject getJWTPrivsObject(); QString getIP(); diff --git a/Modules/Account/functionalTest/ORM/tokens.hpp b/Modules/Account/functionalTest/ORM/tokens.hpp index b0b029fd..a0cf1b95 100644 --- a/Modules/Account/functionalTest/ORM/tokens.hpp +++ b/Modules/Account/functionalTest/ORM/tokens.hpp @@ -48,7 +48,7 @@ private slots: QVERIFY(callAdminAPI(RESTClientHelper::PUT, QString("Account/APITokens/"),{},{ {"aptToken", UT_NormalToken}, - {"apt_usrID", clsJWT(gJWT).usrID()}, + {"apt_usrID", clsJWT(gJWT).actorID()}, }) == gInvalid); QVERIFY(callAdminAPI(RESTClientHelper::PUT, QString("Account/APITokens/"),{},{ @@ -60,19 +60,19 @@ private slots: QVERIFY(callAdminAPI(RESTClientHelper::PUT, QString("Account/APITokens/"),{},{ {"aptToken", UT_NormalToken}, {"apt_svcID", 0}, - {"apt_usrID", clsJWT(gJWT).usrID()}, + {"apt_usrID", clsJWT(gJWT).actorID()}, }) == gInvalid); QVERIFY((gAPITokenID = callAdminAPI(RESTClientHelper::PUT, QString("Account/APITokens/"),{},{ {"aptToken", UT_NormalToken}, {"apt_svcID", gServiceID}, - {"apt_usrID", clsJWT(gJWT).usrID()}, + {"apt_usrID", clsJWT(gJWT).actorID()}, }).toUInt()) > 0); QVERIFY((gAPIAdminTokenID = callAdminAPI(RESTClientHelper::PUT, QString("Account/APITokens/"),{},{ {"aptToken", UT_AdminToken}, {"apt_svcID", gServiceID}, - {"apt_usrID", clsJWT(gAdminJWT).usrID()}, + {"apt_usrID", clsJWT(gAdminJWT).actorID()}, }).toUInt()) > 0); } @@ -112,7 +112,7 @@ private slots: QVERIFY(callAdminAPI(RESTClientHelper::PUT, QString("Account/APITokens/"),{},{ {"aptToken", UT_NormalToken}, {"apt_svcID", gServiceID}, - {"apt_usrID", clsJWT(gJWT).usrID()}, + {"apt_usrID", clsJWT(gJWT).actorID()}, }) == gInvalid); } diff --git a/Modules/Account/functionalTest/testAccount.hpp b/Modules/Account/functionalTest/testAccount.hpp index b19200cf..2638cb3a 100644 --- a/Modules/Account/functionalTest/testAccount.hpp +++ b/Modules/Account/functionalTest/testAccount.hpp @@ -390,7 +390,7 @@ private slots: gEncodedJWT = Result.toString(); gJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gJWT).usrID() == UserID); + QVERIFY(clsJWT(gJWT).actorID() == UserID); QVERIFY(clsJWT(gJWT).usrStatus() == TAPI::enuUserStatus::Active); } @@ -552,7 +552,7 @@ private slots: gEncodedJWT = Result.toString(); gJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gJWT).usrID() == gUserID); + QVERIFY(clsJWT(gJWT).actorID() == gUserID); QVERIFY(clsJWT(gJWT).usrStatus() == TAPI::enuUserStatus::Active); } diff --git a/Modules/Account/moduleSrc/Account.cpp b/Modules/Account/moduleSrc/Account.cpp index f1f30f39..8c1400b2 100644 --- a/Modules/Account/moduleSrc/Account.cpp +++ b/Modules/Account/moduleSrc/Account.cpp @@ -201,17 +201,17 @@ TAPI::EncodedJWT_t Account::createJWTAndSaveToActiveSession( auto ServerTiming = APICALLBOOM_PARAM.createScopeTiming("jwt", "create"); QJsonObject Payload = { + { JWTItems::iat, _activeAccount.Privs["Issuance"] }, + { JWTItems::uid, _activeAccount.Privs["usrID"] }, + { JWTItems::privs, _activeAccount.Privs["privs"] }, { JWTItems::usrLogin, _login }, - { JWTItems::usrID, _activeAccount.Privs["usrID"] }, { JWTItems::usrName, _activeAccount.Privs["usrName"] }, { JWTItems::usrFamily, _activeAccount.Privs["usrFamily"] }, - { JWTItems::rolID, _activeAccount.Privs["usr_rolID"] }, - { JWTItems::rolName, _activeAccount.Privs["rolName"] }, - { JWTItems::privs, _activeAccount.Privs["privs"] }, { JWTItems::usrApproval, TAPI::enuUserApproval::toStr(_activeAccount.Privs["usrApprovalState"].toString()) }, { JWTItems::usrStatus, TAPI::enuUserStatus::toStr(_activeAccount.Privs["usrStatus"].toString()) }, { JWTItems::canChangePass, _activeAccount.Privs["hasPass"] }, - { JWTItems::iat, _activeAccount.Privs["Issuance"] }, + { JWTItems::rolID, _activeAccount.Privs["usr_rolID"] }, + { JWTItems::rolName, _activeAccount.Privs["rolName"] }, }; TAPI::EncodedJWT_t JWT = QJWT::createSigned( @@ -567,7 +567,7 @@ bool IMPL_REST_GET_OR_POST(Account, logout, ( this->callSP(APICALLBOOM_PARAM, "spLogout", { - { "iByUserID", JWT.usrID() }, + { "iByUserID", JWT.actorID() }, { "iSessionGUID", JWT.session() }, }); @@ -663,7 +663,7 @@ bool IMPL_REST_GET_OR_POST(Account, changePass, ( this->callSP(APICALLBOOM_PARAM, "spPassword_Change", { - { "iUserID", JWT.usrID() }, + { "iUserID", JWT.actorID() }, { "iSessionGUID", JWT.session() }, { "iOldPass", _oldPass }, { "iOldPassSalt", _oldPassSalt }, @@ -737,7 +737,7 @@ bool IMPL_REST_POST(Account, cancelVoucher, ( quint64 CurrentUserID = 0; if (Authorization::hasPriv(APICALLBOOM_PARAM, { "AAA:cancelVoucher" }) == false) - CurrentUserID = APICALLBOOM_PARAM.getUserID(); + CurrentUserID = APICALLBOOM_PARAM.getActorID(); ///@TODO: implement this sp @@ -817,7 +817,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_POST(Account, finalizeBasket, ( checkPreVoucherSanity(_preVoucher); - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); if (_preVoucher.UserID != CurrentUserID) throw exHTTPBadRequest("invalid pre-Voucher owner" /*, stuVoucher(_preVoucher).toJson() */); @@ -1186,7 +1186,7 @@ Targoman::API::AAA::stuVoucher Account::payAndProcessBasket( QFV.url().validate(_paymentVerifyCallback, "callBack"); } -// quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); +// quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); tblVoucher::DTO VoucherDTO = SelectQuery(Voucher::instance()) .addCols(Voucher::instance().selectableColumnNames()) @@ -1491,7 +1491,7 @@ quint64 IMPL_REST_POST(Account, claimOfflinePayment, ( //check operator or owner if (Authorization::hasPriv(APICALLBOOM_PARAM, { "AAA:claimOfflinePayment" }) == false) { - if (VoucherDTO.vch_usrID != APICALLBOOM_PARAM.getUserID()) + if (VoucherDTO.vch_usrID != APICALLBOOM_PARAM.getActorID()) throw exAuthorization("Voucher is not yours"); } @@ -1567,7 +1567,7 @@ bool IMPL_REST_POST(Account, rejectOfflinePayment, ( //check operator or owner if (Authorization::hasPriv(APICALLBOOM_PARAM, { "AAA:rejectOfflinePayment" }) == false) { - if (OfflinePaymentDTO.ofpCreatedBy_usrID != APICALLBOOM_PARAM.getUserID()) + if (OfflinePaymentDTO.ofpCreatedBy_usrID != APICALLBOOM_PARAM.getActorID()) throw exAuthorization("This offline payment claim is not yours"); } @@ -1624,7 +1624,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_POST(Account, approveOfflinePayment, ( if (NULLABLE_IS_NULL(OfflinePaymentDTO.ofp_vchID)) { Targoman::API::AAA::stuVoucher Voucher; - Voucher.Info.UserID = OfflinePaymentDTO.ofpCreatedBy_usrID; //APICALLBOOM_PARAM.getUserID(); + Voucher.Info.UserID = OfflinePaymentDTO.ofpCreatedBy_usrID; //APICALLBOOM_PARAM.getActorID(); // Voucher.Info.Type = enuPreVoucherType::IncreaseWallet; Voucher.Info.Items.append(Targoman::API::AAA::stuVoucherItem(VOUCHER_ITEM_NAME_INC_WALLET, _walID)); Voucher.Info.Summary = "Increase wallet"; @@ -1633,7 +1633,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_POST(Account, approveOfflinePayment, ( Voucher.ID = Voucher::instance().Create(APICALLBOOM_PARAM, TAPI::ORMFields_t({ - { tblVoucher::Fields::vch_usrID, OfflinePaymentDTO.ofpCreatedBy_usrID }, //APICALLBOOM_PARAM.getUserID() }, + { tblVoucher::Fields::vch_usrID, OfflinePaymentDTO.ofpCreatedBy_usrID }, //APICALLBOOM_PARAM.getActorID() }, // { tblVoucher::Fields::vchDesc, QJsonDocument(Voucher.Info.toJson()).toJson(QJsonDocument::Compact).constData() }, { tblVoucher::Fields::vchDesc, Voucher.Info.toJson().toVariantMap() }, { tblVoucher::Fields::vchTotalAmount, Voucher.Info.ToPay }, @@ -1743,7 +1743,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_POST(Account, approveOfflinePayment_wit if (RemainingAfterWallet > 0) return Targoman::API::AAA::stuVoucher(); - return Account::processVoucher(APICALLBOOM_PARAM.getUserID(), _vchID); + return Account::processVoucher(APICALLBOOM_PARAM.getActorID(), _vchID); } catch (...) { this->Update(OfflinePayments::instance(), @@ -1859,7 +1859,7 @@ Targoman::API::AAA::stuVoucher Account::processVoucher( //bypass process by end point? if (NULLABLE_HAS_VALUE(ProcessVoucherItemEndPoint)) { stuVoucherItemForTrustedAction VoucherItemForTrustedAction; - VoucherItemForTrustedAction.UserID = VoucherDTO.vch_usrID; //APICALLBOOM_PARAM.getUserID(); + VoucherItemForTrustedAction.UserID = VoucherDTO.vch_usrID; //APICALLBOOM_PARAM.getActorID(); VoucherItemForTrustedAction.VoucherID = _voucherID; VoucherItemForTrustedAction.VoucherItem = VoucherItem; VoucherItemForTrustedAction.Sign.clear(); @@ -2041,7 +2041,7 @@ void Account::tryCancelVoucher( if (NULLABLE_HAS_VALUE(CancelVoucherItemEndPoint)) { try { stuVoucherItemForTrustedAction VoucherItemForTrustedAction; - VoucherItemForTrustedAction.UserID = APICALLBOOM_PARAM.getUserID(); + VoucherItemForTrustedAction.UserID = APICALLBOOM_PARAM.getActorID(); VoucherItemForTrustedAction.VoucherID = _voucherID; VoucherItemForTrustedAction.VoucherItem = VoucherItem; VoucherItemForTrustedAction.Sign.clear(); @@ -2109,7 +2109,7 @@ quint64 IMPL_REST_POST(Account, addPrizeTo, ( "spWallet_Increase", { { "iWalletID", 0 }, { "iForUsrID", _targetUsrID }, - { "iByUserID", APICALLBOOM_PARAM.getUserID() }, + { "iByUserID", APICALLBOOM_PARAM.getActorID() }, { "iType", QString(static_cast(enuVoucherType::Prize)) }, { "iAmount", _amount }, { "iDesc", _desc }, @@ -2140,7 +2140,7 @@ quint64 IMPL_REST_POST(Account, addIncomeTo, ( "spWallet_Increase", { { "iWalletID", 0 }, { "iForUsrID", _targetUsrID }, - { "iByUserID", APICALLBOOM_PARAM.getUserID() }, + { "iByUserID", APICALLBOOM_PARAM.getActorID() }, { "iType", QString(static_cast(enuVoucherType::Income)) }, { "iAmount", _amount }, { "iDesc", _desc }, diff --git a/Modules/Account/moduleSrc/ORM/APITokenValidIPs.cpp b/Modules/Account/moduleSrc/ORM/APITokenValidIPs.cpp index 1cba5a15..9c37c96b 100644 --- a/Modules/Account/moduleSrc/ORM/APITokenValidIPs.cpp +++ b/Modules/Account/moduleSrc/ORM/APITokenValidIPs.cpp @@ -37,7 +37,7 @@ APITokenValidIPs::APITokenValidIPs() : QVariant IMPL_ORMGET(APITokenValidIPs) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getUserID()}}, _filters); + this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getActorID()}}, _filters); auto fnTouchQuery = [](ORMSelectQuery &_query) { _query.innerJoin(tblAPITokens::Name); @@ -55,9 +55,9 @@ quint64 IMPL_ORMCREATE(APITokenValidIPs) { bool IMPL_ORMUPDATE(APITokenValidIPs) { TAPI::ORMFields_t ExtraFilters; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_PATCH,this->moduleBaseName())) == false) - ExtraFilters.insert(tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getUserID()); + ExtraFilters.insert(tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getActorID()); -// this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getUserID()}}, ExtraFilters); +// this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getActorID()}}, ExtraFilters); return this->Update(UPDATE_METHOD_ARGS_CALL_VALUES, ExtraFilters); } @@ -66,8 +66,8 @@ bool IMPL_ORMDELETE(APITokenValidIPs) { TAPI::ORMFields_t ExtraFilters; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_DELETE, this->moduleBaseName())) == false) - ExtraFilters.insert(tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getUserID()); -// this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getUserID()}}, ExtraFilters); + ExtraFilters.insert(tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getActorID()); +// this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getActorID()}}, ExtraFilters); return this->DeleteByPks(DELETE_METHOD_ARGS_CALL_VALUES, ExtraFilters, true); // return this->deleteByPKs(DELETE_METHOD_CALL_ARGS_APICALL, ExtraFilters, true); diff --git a/Modules/Account/moduleSrc/ORM/APITokens.cpp b/Modules/Account/moduleSrc/ORM/APITokens.cpp index f09ab474..029ee024 100644 --- a/Modules/Account/moduleSrc/ORM/APITokens.cpp +++ b/Modules/Account/moduleSrc/ORM/APITokens.cpp @@ -35,11 +35,11 @@ APITokens::APITokens() : tblAPITokens::Private::ORMFields, tblAPITokens::Private::Relations, tblAPITokens::Private::Indexes - ) { ; } +) { ; } QVariant IMPL_ORMGET(APITokens) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getUserID()}}, _filters); + this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getActorID()}}, _filters); return this->Select(GET_METHOD_ARGS_CALL_VALUES); } @@ -59,8 +59,8 @@ bool IMPL_ORMUPDATE(APITokens) { bool IMPL_ORMDELETE(APITokens) { TAPI::ORMFields_t ExtraFilters; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_DELETE, this->moduleBaseName())) == false) - ExtraFilters.insert(tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getUserID()); -// this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getUserID()}}, ExtraFilters); + ExtraFilters.insert(tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getActorID()); +// this->setSelfFilters({{tblAPITokens::Fields::apt_usrID, APICALLBOOM_PARAM.getActorID()}}, ExtraFilters); return this->DeleteByPks(DELETE_METHOD_ARGS_CALL_VALUES, ExtraFilters); } diff --git a/Modules/Account/moduleSrc/ORM/ActiveSessions.cpp b/Modules/Account/moduleSrc/ORM/ActiveSessions.cpp index a6c23ff8..c0832ebd 100644 --- a/Modules/Account/moduleSrc/ORM/ActiveSessions.cpp +++ b/Modules/Account/moduleSrc/ORM/ActiveSessions.cpp @@ -43,7 +43,7 @@ QVariant IMPL_ORMGET(ActiveSessions) { // QVariantMap ExtraFilters; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblActiveSessions::Fields::ssn_usrID, APICALLBOOM_PARAM.getUserID()}}, _filters); + this->setSelfFilters({{tblActiveSessions::Fields::ssn_usrID, APICALLBOOM_PARAM.getActorID()}}, _filters); return this->Select(GET_METHOD_ARGS_CALL_VALUES); @@ -59,8 +59,8 @@ bool IMPL_ORMDELETE(ActiveSessions) { throw exHTTPForbidden("Deleting current session is not allowed"); if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_DELETE, this->moduleBaseName())) == false) - ExtraFilters.insert(tblActiveSessions::Fields::ssn_usrID, APICALLBOOM_PARAM.getUserID()); -// this->setSelfFilters({{tblActiveSessions::Fields::ssn_usrID, APICALLBOOM_PARAM.getUserID()}}, ExtraFilters); + ExtraFilters.insert(tblActiveSessions::Fields::ssn_usrID, APICALLBOOM_PARAM.getActorID()); +// this->setSelfFilters({{tblActiveSessions::Fields::ssn_usrID, APICALLBOOM_PARAM.getActorID()}}, ExtraFilters); return this->DeleteByPks(DELETE_METHOD_ARGS_CALL_VALUES, ExtraFilters, true); // return this->deleteByPKs(DELETE_METHOD_CALL_ARGS_APICALL, ExtraFilters, true); diff --git a/Modules/Account/moduleSrc/ORM/Currency.cpp b/Modules/Account/moduleSrc/ORM/Currency.cpp index 9e24a45a..b54540d1 100644 --- a/Modules/Account/moduleSrc/ORM/Currency.cpp +++ b/Modules/Account/moduleSrc/ORM/Currency.cpp @@ -72,7 +72,7 @@ bool IMPL_REST_UPDATE(Currency, setAsDefault, ( this->callSP(APICALLBOOM_PARAM, "spCurrency_SetAsDefault", { - { "iUserID", APICALLBOOM_PARAM.getUserID() }, + { "iUserID", APICALLBOOM_PARAM.getActorID() }, { "iCurID", _pksByPath }, }); diff --git a/Modules/Account/moduleSrc/ORM/Payments.cpp b/Modules/Account/moduleSrc/ORM/Payments.cpp index a1ed1c5a..3dd959e6 100644 --- a/Modules/Account/moduleSrc/ORM/Payments.cpp +++ b/Modules/Account/moduleSrc/ORM/Payments.cpp @@ -61,7 +61,7 @@ OnlinePayments::OnlinePayments() : QVariant IMPL_ORMGET(OnlinePayments) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) this->setSelfFilters({ - { tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getUserID() } + { tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getActorID() } }, _filters); auto fnTouchQuery = [](ORMSelectQuery &_query) { @@ -264,7 +264,7 @@ QVariant IMPL_ORMGET(OfflinePaymentClaims) { UploadQueue::instance().prepareFiltersList(); if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getUserID()}}, _filters); + this->setSelfFilters({{tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getActorID()}}, _filters); auto fnTouchQuery = [this, &APICALLBOOM_PARAM](ORMSelectQuery &_query) { _query @@ -323,8 +323,8 @@ QVariant IMPL_ORMGET(OfflinePaymentClaimsAttachments) { clsCondition ExtraFilters = {}; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) ExtraFilters - .setCond({ tblOfflinePaymentClaims::Fields::ofpcCreatedBy_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getUserID() }) - .orCond({ tblOfflinePaymentClaimsAttachments::Fields::ofpcatCreatedBy_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getUserID() }) + .setCond({ tblOfflinePaymentClaims::Fields::ofpcCreatedBy_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getActorID() }) + .orCond({ tblOfflinePaymentClaimsAttachments::Fields::ofpcatCreatedBy_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getActorID() }) ; auto fnTouchQuery = [this, &APICALLBOOM_PARAM](ORMSelectQuery &_query) { @@ -368,12 +368,12 @@ QVariant IMPL_ORMGET(OfflinePayments) { clsCondition ExtraFilters = {}; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) ExtraFilters - .setCond({ tblVoucher::Fields::vch_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getUserID() }) + .setCond({ tblVoucher::Fields::vch_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getActorID() }) .orCond(clsCondition({ tblVoucher::Fields::vch_usrID, enuConditionOperator::Null }) - .andCond({ tblOfflinePayments::Fields::ofpCreatedBy_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getUserID() })) + .andCond({ tblOfflinePayments::Fields::ofpCreatedBy_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getActorID() })) ; -// this->setSelfFilters({{tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getUserID()}}, _filters); +// this->setSelfFilters({{tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getActorID()}}, _filters); auto fnTouchQuery = [this, &APICALLBOOM_PARAM](ORMSelectQuery &_query) { _query diff --git a/Modules/Account/moduleSrc/ORM/User.cpp b/Modules/Account/moduleSrc/ORM/User.cpp index 21529939..50453ce7 100644 --- a/Modules/Account/moduleSrc/ORM/User.cpp +++ b/Modules/Account/moduleSrc/ORM/User.cpp @@ -61,7 +61,7 @@ User::User() : } QVariant IMPL_ORMGET(User) { - if (APICALLBOOM_PARAM.getUserID() != _pksByPath.toULongLong()) + if (APICALLBOOM_PARAM.getActorID() != _pksByPath.toULongLong()) Authorization::checkPriv(APICALLBOOM_PARAM, { "Account:User:CRUD~0100" }); if (_cols.isEmpty()) @@ -149,7 +149,7 @@ TAPI::Base64Image_t IMPL_REST_GET(User, photo, ( APICALLBOOM_TYPE_JWT_IMPL &APICALLBOOM_PARAM, quint64 _usrID )) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); if (CurrentUserID != _usrID) Authorization::checkPriv(APICALLBOOM_PARAM, { "Account:User:photo:CRUD~0100" }); @@ -167,7 +167,7 @@ bool IMPL_REST_UPDATE(User, photo, ( APICALLBOOM_TYPE_JWT_IMPL &APICALLBOOM_PARAM, TAPI::Base64Image_t _image )) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); QString qry = QString() + "INSERT INTO" @@ -198,7 +198,7 @@ bool IMPL_REST_UPDATE(User, photo, ( bool IMPL_REST_POST(User, deletePhoto, ( APICALLBOOM_TYPE_JWT_IMPL &APICALLBOOM_PARAM )) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); QString qry = QString() + "UPDATE" @@ -228,7 +228,7 @@ bool IMPL_REST_UPDATE(User, email, ( TAPI::MD5_t _psw, QString _salt )) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); _email = _email.toLower().trimmed(); @@ -261,7 +261,7 @@ bool IMPL_REST_UPDATE(User, mobile, ( TAPI::MD5_t _psw, QString _salt )) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); _mobile = PhoneHelper::NormalizePhoneNumber(_mobile); @@ -297,7 +297,7 @@ bool IMPL_REST_UPDATE(User, personalInfo, ( NULLABLE_TYPE(bool) _enableEmailAlerts, NULLABLE_TYPE(bool) _enableSMSAlerts )) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); QVariantMap ToUpdate; @@ -322,7 +322,7 @@ bool IMPL_REST_UPDATE(User, financialInfo, ( TAPI::Sheba_t _iban, TAPI::Ether_t _ether )) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); QStringList ToUpdate; QVariantList Params; @@ -369,7 +369,7 @@ bool IMPL_REST_UPDATE(User, extraInfo, ( // QString _language, QString _theme )) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); QVariantMap ToUpdateJson; QStringList ToRemoveJson; @@ -505,7 +505,7 @@ UserExtraInfo::UserExtraInfo() : // + "SET " + tblUserExtraInfo::Fields::ueiEther +" = ?, " +tblUserExtraInfo::Fields::ueiUpdatedBy_usrID + " = ?" // + QUERY_SEPARATOR // + "WHERE uei_usrID = ?", -// { _sheba, APICALLBOOM_PARAM.getUserID(), APICALLBOOM_PARAM.getUserID() } +// { _sheba, APICALLBOOM_PARAM.getActorID(), APICALLBOOM_PARAM.getActorID() } // ); // return Result.numRowsAffected() > 0; @@ -519,7 +519,7 @@ UserExtraInfo::UserExtraInfo() : // + "SET " + tblUserExtraInfo::Fields::ueiEther +" = ?, " +tblUserExtraInfo::Fields::ueiUpdatedBy_usrID + " = ?" // + QUERY_SEPARATOR // + "WHERE uei_usrID = ?", -// { _etherAddress, APICALLBOOM_PARAM.getUserID(), APICALLBOOM_PARAM.getUserID() } +// { _etherAddress, APICALLBOOM_PARAM.getActorID(), APICALLBOOM_PARAM.getActorID() } // ); // return Result.numRowsAffected() > 0; diff --git a/Modules/Account/moduleSrc/ORM/UserWallets.cpp b/Modules/Account/moduleSrc/ORM/UserWallets.cpp index fb1693f2..cf55108e 100644 --- a/Modules/Account/moduleSrc/ORM/UserWallets.cpp +++ b/Modules/Account/moduleSrc/ORM/UserWallets.cpp @@ -44,7 +44,7 @@ UserWallets::UserWallets() : QVariant IMPL_ORMGET(UserWallets) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({ { tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getUserID() } }, _filters); + this->setSelfFilters({ { tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getActorID() } }, _filters); return this->Select(GET_METHOD_ARGS_CALL_VALUES); } @@ -53,8 +53,8 @@ quint64 IMPL_ORMCREATE(UserWallets) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_DELETE, this->moduleBaseName())) == false) { _createInfo.insert(tblUserWallets::Fields::walDefault, 0); -// this->setSelfFilters({ { tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getUserID() } }, _createInfo); - _createInfo.insert(tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getUserID()); +// this->setSelfFilters({ { tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getActorID() } }, _createInfo); + _createInfo.insert(tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getActorID()); } return this->Create(CREATE_METHOD_ARGS_CALL_VALUES); @@ -71,7 +71,7 @@ bool IMPL_ORMDELETE(UserWallets) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_DELETE, this->moduleBaseName())) == false) { ExtraFilters.insert(tblUserWallets::Fields::walDefault, 0); - ExtraFilters.insert(tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getUserID()); + ExtraFilters.insert(tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getActorID()); } return this->DeleteByPks(DELETE_METHOD_ARGS_CALL_VALUES, ExtraFilters); @@ -90,7 +90,7 @@ bool IMPL_REST_UPDATE(UserWallets, setAsDefault, ( this->callSP(APICALLBOOM_PARAM, "spWallet_SetAsDefault", { - { "iUserID", (IsPrivileged ? 0 : APICALLBOOM_PARAM.getUserID()) }, + { "iUserID", (IsPrivileged ? 0 : APICALLBOOM_PARAM.getActorID()) }, { "iWalID", _pksByPath }, }); @@ -112,7 +112,7 @@ bool IMPL_REST_CREATE(UserWallets, transfer, ( this->callSP(APICALLBOOM_PARAM, "spWallet_Transfer", { - { "iFromUserID", APICALLBOOM_PARAM.getUserID() }, + { "iFromUserID", APICALLBOOM_PARAM.getActorID() }, { "iPass", _pass }, { "iSalt", _salt }, { "iFromWalID", _fromWalID }, @@ -138,7 +138,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_CREATE(UserWallets, requestIncrease, ( stuVoucher Voucher; - Voucher.Info.UserID = APICALLBOOM_PARAM.getUserID(); + Voucher.Info.UserID = APICALLBOOM_PARAM.getActorID(); // Voucher.Info.Type = enuPreVoucherType::IncreaseWallet; Voucher.Info.Items.append(Targoman::API::AAA::stuVoucherItem(VOUCHER_ITEM_NAME_INC_WALLET, _walID)); Voucher.Info.Summary = "Increase wallet"; @@ -150,7 +150,7 @@ Targoman::API::AAA::stuVoucher IMPL_REST_CREATE(UserWallets, requestIncrease, ( Voucher.ID = Voucher::instance().Create( APICALLBOOM_PARAM, TAPI::ORMFields_t({ - { tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getUserID() }, + { tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getActorID() }, { tblVoucher::Fields::vchType, Targoman::API::AAA::enuVoucherType::Credit }, // { tblVoucher::Fields::vchDesc, QJsonDocument(Voucher.Info.toJson()).toJson().constData() }, { tblVoucher::Fields::vchDesc, Voucher.Info.toJson().toVariantMap() }, @@ -200,8 +200,8 @@ quint64 IMPL_REST_POST(UserWallets, requestWithdrawal, ( return this->callSP(APICALLBOOM_PARAM, "spWithdrawal_Request", { { "iWalletID", _walID }, - { "iForUsrID", APICALLBOOM_PARAM.getUserID() }, - { "iByUserID", APICALLBOOM_PARAM.getUserID() }, + { "iForUsrID", APICALLBOOM_PARAM.getActorID() }, + { "iByUserID", APICALLBOOM_PARAM.getActorID() }, { "iAmount", _amount }, { "iDesc", _desc }, }).spDirectOutputs().value("oVoucherID").toULongLong(); @@ -223,7 +223,7 @@ quint64 IMPL_REST_POST(UserWallets, requestWithdrawalFor, ( "spWithdrawal_Request", { { "iWalletID", 0 }, { "iForUsrID", _targetUsrID }, - { "iByUserID", APICALLBOOM_PARAM.getUserID() }, + { "iByUserID", APICALLBOOM_PARAM.getActorID() }, { "iAmount", _amount }, { "iDesc", _desc }, }).spDirectOutputs().value("oVoucherID").toULongLong(); @@ -242,7 +242,7 @@ bool IMPL_REST_POST(UserWallets, acceptWithdrawal, ( this->callSP(APICALLBOOM_PARAM, "spWithdrawal_Accept", { { "iVoucherID", _voucherID }, - { "iOperator_usrID", APICALLBOOM_PARAM.getUserID() }, + { "iOperator_usrID", APICALLBOOM_PARAM.getActorID() }, }); return true; diff --git a/Modules/Account/moduleSrc/ORM/Voucher.cpp b/Modules/Account/moduleSrc/ORM/Voucher.cpp index 83d861d6..d519c522 100644 --- a/Modules/Account/moduleSrc/ORM/Voucher.cpp +++ b/Modules/Account/moduleSrc/ORM/Voucher.cpp @@ -61,7 +61,7 @@ ORMSelectQuery Voucher::makeSelectQuery(INTFAPICALLBOOM_IMPL &APICALLBOOM_PARAM, QVariant IMPL_ORMGET(Voucher) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getUserID()}}, _filters); + this->setSelfFilters({{tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getActorID()}}, _filters); return this->Select(GET_METHOD_ARGS_CALL_VALUES); } @@ -72,8 +72,8 @@ bool IMPL_ORMDELETE(Voucher) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_DELETE, this->moduleBaseName())) == false) { ExtraFilters.insert(tblVoucher::Fields::vchType, Targoman::API::AAA::enuVoucherType::toStr(Targoman::API::AAA::enuVoucherType::Withdrawal)); - ExtraFilters.insert(tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getUserID()); -// this->setSelfFilters({{tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getUserID()}}, ExtraFilters); + ExtraFilters.insert(tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getActorID()); +// this->setSelfFilters({{tblVoucher::Fields::vch_usrID, APICALLBOOM_PARAM.getActorID()}}, ExtraFilters); } return this->DeleteByPks(DELETE_METHOD_ARGS_CALL_VALUES, ExtraFilters); diff --git a/Modules/Account/moduleSrc/ORM/WalletTransactions.cpp b/Modules/Account/moduleSrc/ORM/WalletTransactions.cpp index fa7d9e0f..c7bc23f5 100644 --- a/Modules/Account/moduleSrc/ORM/WalletTransactions.cpp +++ b/Modules/Account/moduleSrc/ORM/WalletTransactions.cpp @@ -55,7 +55,7 @@ WalletTransactions::WalletTransactions() : QVariant IMPL_ORMGET(WalletTransactions) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getUserID()}}, _filters); + this->setSelfFilters({{tblUserWallets::Fields::wal_usrID, APICALLBOOM_PARAM.getActorID()}}, _filters); auto fnTouchQuery = [](ORMSelectQuery &_query) { _query.innerJoin(tblUserWallets::Name); diff --git a/Modules/Advert/functionalTest/testAdvert.hpp b/Modules/Advert/functionalTest/testAdvert.hpp index b7c8f848..fa13ccbf 100644 --- a/Modules/Advert/functionalTest/testAdvert.hpp +++ b/Modules/Advert/functionalTest/testAdvert.hpp @@ -241,7 +241,7 @@ private slots: gEncodedJWT = Result.toString(); gJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gJWT).usrID() == gUserID); + QVERIFY(clsJWT(gJWT).actorID() == gUserID); QVERIFY(clsJWT(gJWT).usrStatus() == TAPI::enuUserStatus::Active); } @@ -258,7 +258,7 @@ private slots: gEncodedAdminJWT = Result.toString(); gAdminJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedAdminJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gAdminJWT).usrID() == gAdminUserID); + QVERIFY(clsJWT(gAdminJWT).actorID() == gAdminUserID); QVERIFY(clsJWT(gAdminJWT).usrStatus() == TAPI::enuUserStatus::Active); } @@ -348,8 +348,8 @@ private slots: { tblAccountProductsBase::Fields::prdName, "test product 123" }, { tblAccountProductsBase::Fields::prdInStockQty, 1'000 }, { tblAccountProductsBase::Fields::prd_untID, 1 }, - { tblAccountProducts::ExtraFields::prdExType, Targoman::API::AdvertModule::enuProductType::toStr(Targoman::API::AdvertModule::enuProductType::Advertise) }, - { tblAccountProducts::ExtraFields::prdEx_locID, this->LocationID }, + { tblAccountProducts::ExtraFields::prdType, Targoman::API::AdvertModule::enuProductType::toStr(Targoman::API::AdvertModule::enuProductType::Advertise) }, + { tblAccountProducts::ExtraFields::prd_locID, this->LocationID }, { tblAccountProductsBase::Fields::prdNameI18N, QVariantMap({ { "fa", "عنوان فارسی ۱۲۳" }, { "ar", "عنوان عربی ۱۲۳" }, diff --git a/Modules/Advert/functionalTest/testAdvertFixture.hpp b/Modules/Advert/functionalTest/testAdvertFixture.hpp index 5534f6d8..410d0666 100644 --- a/Modules/Advert/functionalTest/testAdvertFixture.hpp +++ b/Modules/Advert/functionalTest/testAdvertFixture.hpp @@ -128,7 +128,7 @@ private slots: gEncodedJWT = Result.toString(); gJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gJWT).usrID() == gUserID); + QVERIFY(clsJWT(gJWT).actorID() == gUserID); QVERIFY(clsJWT(gJWT).usrStatus() == TAPI::enuUserStatus::Active); } @@ -145,7 +145,7 @@ private slots: gEncodedAdminJWT = Result.toString(); gAdminJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedAdminJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gAdminJWT).usrID() == gAdminUserID); + QVERIFY(clsJWT(gAdminJWT).actorID() == gAdminUserID); QVERIFY(clsJWT(gAdminJWT).usrStatus() == TAPI::enuUserStatus::Active); } diff --git a/Modules/Advert/migrations/db/m20220810_232558_Advert_remove_ex.sql b/Modules/Advert/migrations/db/m20220810_232558_Advert_remove_ex.sql new file mode 100644 index 00000000..6a7deef8 --- /dev/null +++ b/Modules/Advert/migrations/db/m20220810_232558_Advert_remove_ex.sql @@ -0,0 +1,39 @@ +/* Migration File: m20220810_232558_Advert_remove_ex.sql */ +/* CAUTION: don't forget to use {{dbprefix}} for schemas */ + +USE `{{dbprefix}}{{Schema}}`; + +ALTER TABLE `tblAccountAssetUsage` + CHANGE COLUMN `usgExRemainingDays` `usgRemainingDays` SMALLINT(5) NOT NULL DEFAULT '0' AFTER `usg_uasID`, + CHANGE COLUMN `usgExDayShow` `usgDayShow` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `usgRemainingDays`, + CHANGE COLUMN `usgExTotalShow` `usgTotalShow` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `usgDayShow`, + CHANGE COLUMN `usgExDayClicks` `usgDayClicks` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `usgTotalShow`, + CHANGE COLUMN `usgExMonthClicks` `usgMonthClicks` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `usgDayClicks`, + CHANGE COLUMN `usgExTotalClicks` `usgTotalClicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `usgMonthClicks`; + +ALTER TABLE `tblAccountProducts` + CHANGE COLUMN `prdExType` `prdType` CHAR(1) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci' AFTER `prdUpdatedBy_usrID`, + CHANGE COLUMN `prdEx_locID` `prd_locID` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `prdType`, + CHANGE COLUMN `prdExDuration` `prdDuration` INT(10) NULL DEFAULT '-1' AFTER `prd_locID`, + CHANGE COLUMN `prdExShowPerDay` `prdShowPerDay` INT(10) NULL DEFAULT '-1' AFTER `prdDuration`, + CHANGE COLUMN `prdExShowTotal` `prdShowTotal` INT(10) NULL DEFAULT '-1' AFTER `prdShowPerDay`, + CHANGE COLUMN `prdExClicksPerDay` `prdClicksPerDay` INT(10) NULL DEFAULT '-1' AFTER `prdShowTotal`, + CHANGE COLUMN `prdExClicksPerMonth` `prdClicksPerMonth` INT(10) NULL DEFAULT '-1' AFTER `prdClicksPerDay`, + CHANGE COLUMN `prdExClicksTotal` `prdClicksTotal` BIGINT(19) NULL DEFAULT '-1' AFTER `prdClicksPerMonth`, + DROP INDEX `FK_tblAccountProducts_tblLocations`, + ADD INDEX `FK_tblAccountProducts_tblLocations` (`prd_locID`) USING BTREE; + +ALTER TABLE `tblAccountSaleables` + CHANGE COLUMN `slbExShowPerDay` `slbShowPerDay` INT(10) NOT NULL DEFAULT '0' AFTER `slbUpdatedBy_usrID`, + CHANGE COLUMN `slbExShowTotal` `slbShowTotal` INT(10) NOT NULL DEFAULT '0' AFTER `slbShowPerDay`, + CHANGE COLUMN `slbExClicksPerDay` `slbClicksPerDay` INT(10) NOT NULL DEFAULT '0' AFTER `slbShowTotal`, + CHANGE COLUMN `slbExClicksPerMonth` `slbClicksPerMonth` INT(10) NOT NULL DEFAULT '0' AFTER `slbClicksPerDay`, + CHANGE COLUMN `slbExClicksTotal` `slbClicksTotal` INT(10) NOT NULL DEFAULT '0' AFTER `slbClicksPerMonth`; + +ALTER TABLE `tblAccountUserAssets` + CHANGE COLUMN `uasExDays` `uasDays` MEDIUMINT(7) NULL DEFAULT '0' AFTER `uasUpdatedBy_usrID`, + CHANGE COLUMN `uasExDayShow` `uasDayShow` INT(10) UNSIGNED NULL DEFAULT '0' AFTER `uasDays`, + CHANGE COLUMN `uasExTotalShow` `uasTotalShow` BIGINT(20) UNSIGNED NULL DEFAULT '0' AFTER `uasDayShow`, + CHANGE COLUMN `uasExDayClicks` `uasDayClicks` INT(10) UNSIGNED NULL DEFAULT '0' AFTER `uasTotalShow`, + CHANGE COLUMN `uasExMonthClicks` `uasMonthClicks` INT(10) UNSIGNED NULL DEFAULT '0' AFTER `uasDayClicks`, + CHANGE COLUMN `uasExTotalClicks` `uasTotalClicks` BIGINT(20) UNSIGNED NULL DEFAULT '0' AFTER `uasMonthClicks`; diff --git a/Modules/Advert/moduleSrc/Advert.cpp b/Modules/Advert/moduleSrc/Advert.cpp index 66f15b19..d12e19e5 100644 --- a/Modules/Advert/moduleSrc/Advert.cpp +++ b/Modules/Advert/moduleSrc/Advert.cpp @@ -72,8 +72,8 @@ Advert::Advert() : AdvertSchema, { // day week month total - { "show", { "slbExShowPerDay", {}, {}, "slbExShowTotal" } }, - { "click", { "slbExClicksPerDay", {}, "slbExClicksPerMonth", "slbExClicksTotal" } }, + { "show", { "slbShowPerDay", {}, {}, "slbShowTotal" } }, + { "click", { "slbClicksPerDay", {}, "slbClicksPerMonth", "slbClicksTotal" } }, }, &AccountUnits::instance(), // &AccountUnitsI18N::instance(), @@ -217,7 +217,7 @@ QVariantMap Advert::getCustomUserAssetFieldsForQuery( QVariantMap Result; if (_assetItem.AdditionalInfo.contains(ASSET_ITEM_ADDITIONAL_INTO_KEY_PLUS_MAX_DAYS)) - Result.insert(tblAccountUserAssets::ExtraFields::uasExDays, _assetItem.AdditionalInfo[ASSET_ITEM_ADDITIONAL_INTO_KEY_PLUS_MAX_DAYS].toInt()); + Result.insert(tblAccountUserAssets::ExtraFields::uasDays, _assetItem.AdditionalInfo[ASSET_ITEM_ADDITIONAL_INTO_KEY_PLUS_MAX_DAYS].toInt()); return Result; } @@ -321,8 +321,8 @@ QVariant IMPL_REST_POST(Advert, fixtureSetup, ( }) }, { tblAccountProductsBase::Fields::prdInStockQty, 1'000 }, { tblAccountProductsBase::Fields::prd_untID, 1 }, - { tblAccountProducts::ExtraFields::prdExType, Targoman::API::AdvertModule::enuProductType::toStr(Targoman::API::AdvertModule::enuProductType::Advertise) }, - { tblAccountProducts::ExtraFields::prdEx_locID, LocationID }, + { tblAccountProducts::ExtraFields::prdType, Targoman::API::AdvertModule::enuProductType::toStr(Targoman::API::AdvertModule::enuProductType::Advertise) }, + { tblAccountProducts::ExtraFields::prd_locID, LocationID }, }); quint32 ProductID = this->AccountProducts->Create(APICALLBOOM_PARAM, ProductValues); diff --git a/Modules/Advert/moduleSrc/ORM/Accounting.h b/Modules/Advert/moduleSrc/ORM/Accounting.h index ff24b6f4..bccb175e 100644 --- a/Modules/Advert/moduleSrc/ORM/Accounting.h +++ b/Modules/Advert/moduleSrc/ORM/Accounting.h @@ -107,14 +107,14 @@ namespace tblAccountUnitsI18N { namespace tblAccountProducts { namespace ExtraFields { - TARGOMAN_CREATE_CONSTEXPR(prdExType); - TARGOMAN_CREATE_CONSTEXPR(prdEx_locID); - //prdExDuration - TARGOMAN_CREATE_CONSTEXPR(prdExShowPerDay); - TARGOMAN_CREATE_CONSTEXPR(prdExShowTotal); - TARGOMAN_CREATE_CONSTEXPR(prdExClicksPerDay); - TARGOMAN_CREATE_CONSTEXPR(prdExClicksPerMonth); - TARGOMAN_CREATE_CONSTEXPR(prdExClicksTotal); + TARGOMAN_CREATE_CONSTEXPR(prdType); + TARGOMAN_CREATE_CONSTEXPR(prd_locID); + //prdDuration + TARGOMAN_CREATE_CONSTEXPR(prdShowPerDay); + TARGOMAN_CREATE_CONSTEXPR(prdShowTotal); + TARGOMAN_CREATE_CONSTEXPR(prdClicksPerDay); + TARGOMAN_CREATE_CONSTEXPR(prdClicksPerMonth); + TARGOMAN_CREATE_CONSTEXPR(prdClicksTotal); } namespace ExtraRelation { @@ -124,18 +124,18 @@ namespace tblAccountProducts { namespace Private { const QList ExtraORMFields = { ///ColName Type Validation Default UpBy Sort Filter Self Virt PK - { ExtraFields::prdExType, S(Targoman::API::AdvertModule::enuProductType::Type), QFV, QRequired, UPOwner }, - { ExtraFields::prdEx_locID, S(quint32), QFV.integer().minValue(1), QRequired, UPOwner }, - { ExtraFields::prdExShowPerDay, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, - { ExtraFields::prdExShowTotal, S(quint64), QFV.integer().minValue(-1), -1, UPOwner }, - { ExtraFields::prdExClicksPerDay, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, - { ExtraFields::prdExClicksPerMonth, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, - { ExtraFields::prdExClicksTotal, S(quint64), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::prdType, S(Targoman::API::AdvertModule::enuProductType::Type), QFV, QRequired, UPOwner }, + { ExtraFields::prd_locID, S(quint32), QFV.integer().minValue(1), QRequired, UPOwner }, + { ExtraFields::prdShowPerDay, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::prdShowTotal, S(quint64), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::prdClicksPerDay, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::prdClicksPerMonth, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::prdClicksTotal, S(quint64), QFV.integer().minValue(-1), -1, UPOwner }, }; const QList ExtraRelations = { ///Col Reference Table ForeignCol Rename LeftJoin - { ExtraFields::prdEx_locID, R(AdvertSchema, tblLocations::Name), tblLocations::Fields::locID }, + { ExtraFields::prd_locID, R(AdvertSchema, tblLocations::Name), tblLocations::Fields::locID }, }; const QList ExtraIndexes = { @@ -146,13 +146,13 @@ namespace tblAccountProducts { TAPI_DEFINE_STRUCT(DTO, SF_tblAccountProductsBase_DTO, - SF_Enum (prdExType, Targoman::API::AdvertModule::enuProductType, Targoman::API::AdvertModule::enuProductType::Advertise), - SF_quint32 (prdEx_locID), - SF_quint32 (prdExShowPerDay), - SF_quint64 (prdExShowTotal), - SF_quint32 (prdExClicksPerDay), - SF_quint32 (prdExClicksPerMonth), - SF_quint64 (prdExClicksTotal) + SF_Enum (prdType, Targoman::API::AdvertModule::enuProductType, Targoman::API::AdvertModule::enuProductType::Advertise), + SF_quint32 (prd_locID), + SF_quint32 (prdShowPerDay), + SF_quint64 (prdShowTotal), + SF_quint32 (prdClicksPerDay), + SF_quint32 (prdClicksPerMonth), + SF_quint64 (prdClicksTotal) ); } @@ -187,11 +187,11 @@ namespace tblAccountProductsI18N { namespace tblAccountSaleables { namespace ExtraFields { - TARGOMAN_CREATE_CONSTEXPR(slbExShowPerDay); - TARGOMAN_CREATE_CONSTEXPR(slbExShowTotal); - TARGOMAN_CREATE_CONSTEXPR(slbExClicksPerDay); - TARGOMAN_CREATE_CONSTEXPR(slbExClicksPerMonth); - TARGOMAN_CREATE_CONSTEXPR(slbExClicksTotal); + TARGOMAN_CREATE_CONSTEXPR(slbShowPerDay); + TARGOMAN_CREATE_CONSTEXPR(slbShowTotal); + TARGOMAN_CREATE_CONSTEXPR(slbClicksPerDay); + TARGOMAN_CREATE_CONSTEXPR(slbClicksPerMonth); + TARGOMAN_CREATE_CONSTEXPR(slbClicksTotal); } namespace ExtraRelation { @@ -201,11 +201,11 @@ namespace tblAccountSaleables { namespace Private { const QList ExtraORMFields = { ///ColName Type Validation Default UpBy Sort Filter Self Virt PK - { ExtraFields::slbExShowPerDay, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, - { ExtraFields::slbExShowTotal, S(quint64), QFV.integer().minValue(-1), -1, UPOwner }, - { ExtraFields::slbExClicksPerDay, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, - { ExtraFields::slbExClicksPerMonth, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, - { ExtraFields::slbExClicksTotal, S(quint64), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::slbShowPerDay, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::slbShowTotal, S(quint64), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::slbClicksPerDay, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::slbClicksPerMonth, S(quint32), QFV.integer().minValue(-1), -1, UPOwner }, + { ExtraFields::slbClicksTotal, S(quint64), QFV.integer().minValue(-1), -1, UPOwner }, }; const QList ExtraRelations = { @@ -219,11 +219,11 @@ namespace tblAccountSaleables { TAPI_DEFINE_STRUCT(DTO, SF_tblAccountSaleablesBase_DTO, - SF_quint32 (slbExShowPerDay), - SF_quint64 (slbExShowTotal), - SF_quint32 (slbExClicksPerDay), - SF_quint32 (slbExClicksPerMonth), - SF_quint64 (slbExClicksTotal) + SF_quint32 (slbShowPerDay), + SF_quint64 (slbShowTotal), + SF_quint32 (slbClicksPerDay), + SF_quint32 (slbClicksPerMonth), + SF_quint64 (slbClicksTotal) ); } @@ -284,12 +284,12 @@ namespace tblAccountSaleablesFiles { namespace tblAccountUserAssets { namespace ExtraFields { - TARGOMAN_CREATE_CONSTEXPR(uasExDays); - TARGOMAN_CREATE_CONSTEXPR(uasExDayShow); - TARGOMAN_CREATE_CONSTEXPR(uasExTotalShow); - TARGOMAN_CREATE_CONSTEXPR(uasExDayClicks); - TARGOMAN_CREATE_CONSTEXPR(uasExMonthClicks); - TARGOMAN_CREATE_CONSTEXPR(uasExTotalClicks); + TARGOMAN_CREATE_CONSTEXPR(uasDays); + TARGOMAN_CREATE_CONSTEXPR(uasDayShow); + TARGOMAN_CREATE_CONSTEXPR(uasTotalShow); + TARGOMAN_CREATE_CONSTEXPR(uasDayClicks); + TARGOMAN_CREATE_CONSTEXPR(uasMonthClicks); + TARGOMAN_CREATE_CONSTEXPR(uasTotalClicks); } namespace ExtraRelation { @@ -299,12 +299,12 @@ namespace tblAccountUserAssets { namespace Private { const QList ExtraORMFields = { //ColName Type Validation Default UpBy Sort Filter Self Virt PK - { ExtraFields::uasExDays, S(qint16), QFV.integer().minValue(-1), 0, UPAdmin, false, false }, - { ExtraFields::uasExDayShow, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, - { ExtraFields::uasExTotalShow, S(quint64), QFV.integer().minValue(0), 0, UPAdmin, false, false }, - { ExtraFields::uasExDayClicks, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, - { ExtraFields::uasExMonthClicks, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, - { ExtraFields::uasExTotalClicks, S(quint64), QFV.integer().minValue(0), 0, UPAdmin, false, false } + { ExtraFields::uasDays, S(qint16), QFV.integer().minValue(-1), 0, UPAdmin, false, false }, + { ExtraFields::uasDayShow, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, + { ExtraFields::uasTotalShow, S(quint64), QFV.integer().minValue(0), 0, UPAdmin, false, false }, + { ExtraFields::uasDayClicks, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, + { ExtraFields::uasMonthClicks, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, + { ExtraFields::uasTotalClicks, S(quint64), QFV.integer().minValue(0), 0, UPAdmin, false, false } }; const QList ExtraRelations = { @@ -318,12 +318,12 @@ namespace tblAccountUserAssets { TAPI_DEFINE_STRUCT(DTO, SF_tblAccountUserAssetsBase_DTO, - SF_qint16 (uasExDays), - SF_quint32 (uasExDayShow), - SF_quint64 (uasExTotalShow), - SF_quint32 (uasExDayClicks), - SF_quint32 (uasExMonthClicks), - SF_quint64 (uasExTotalClicks) + SF_qint16 (uasDays), + SF_quint32 (uasDayShow), + SF_quint64 (uasTotalShow), + SF_quint32 (uasDayClicks), + SF_quint32 (uasMonthClicks), + SF_quint64 (uasTotalClicks) ); } @@ -356,13 +356,13 @@ namespace tblAccountUserAssetsFiles { namespace tblAccountAssetUsage { namespace ExtraFields { - //usgExRemainingDays - TARGOMAN_CREATE_CONSTEXPR(usgExDays); - TARGOMAN_CREATE_CONSTEXPR(usgExDayShow); - TARGOMAN_CREATE_CONSTEXPR(usgExTotalShow); - TARGOMAN_CREATE_CONSTEXPR(usgExDayClicks); - TARGOMAN_CREATE_CONSTEXPR(usgExMonthClicks); - TARGOMAN_CREATE_CONSTEXPR(usgExTotalClicks); + //usgRemainingDays + TARGOMAN_CREATE_CONSTEXPR(usgDays); + TARGOMAN_CREATE_CONSTEXPR(usgDayShow); + TARGOMAN_CREATE_CONSTEXPR(usgTotalShow); + TARGOMAN_CREATE_CONSTEXPR(usgDayClicks); + TARGOMAN_CREATE_CONSTEXPR(usgMonthClicks); + TARGOMAN_CREATE_CONSTEXPR(usgTotalClicks); } namespace ExtraRelation { @@ -372,12 +372,12 @@ namespace tblAccountAssetUsage { namespace Private { const QList ExtraORMFields = { //ColName Type Validation Default UpBy Sort Filter Self Virt PK - { ExtraFields::usgExDays, S(qint16), QFV.integer().minValue(-1), 0, UPAdmin, false, false }, - { ExtraFields::usgExDayShow, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, - { ExtraFields::usgExTotalShow, S(quint64), QFV.integer().minValue(0), 0, UPAdmin, false, false }, - { ExtraFields::usgExDayClicks, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, - { ExtraFields::usgExMonthClicks, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, - { ExtraFields::usgExTotalClicks, S(quint64), QFV.integer().minValue(0), 0, UPAdmin, false, false } + { ExtraFields::usgDays, S(qint16), QFV.integer().minValue(-1), 0, UPAdmin, false, false }, + { ExtraFields::usgDayShow, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, + { ExtraFields::usgTotalShow, S(quint64), QFV.integer().minValue(0), 0, UPAdmin, false, false }, + { ExtraFields::usgDayClicks, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, + { ExtraFields::usgMonthClicks, S(quint32), QFV.integer().minValue(0), 0, UPAdmin, false, false }, + { ExtraFields::usgTotalClicks, S(quint64), QFV.integer().minValue(0), 0, UPAdmin, false, false } }; const QList ExtraRelations = { @@ -391,12 +391,12 @@ namespace tblAccountAssetUsage { TAPI_DEFINE_STRUCT(DTO, SF_tblAccountAssetUsageBase_DTO, - SF_qint16 (usgExDays), - SF_quint32 (usgExDayShow), - SF_quint64 (usgExTotalShow), - SF_quint32 (usgExDayClicks), - SF_quint32 (usgExMonthClicks), - SF_quint64 (usgExTotalClicks) + SF_qint16 (usgDays), + SF_quint32 (usgDayShow), + SF_quint64 (usgTotalShow), + SF_quint32 (usgDayClicks), + SF_quint32 (usgMonthClicks), + SF_quint64 (usgTotalClicks) ); } diff --git a/Modules/Advert/moduleSrc/ORM/Clicks.cpp b/Modules/Advert/moduleSrc/ORM/Clicks.cpp index 7c5b1cc9..6b1ee295 100644 --- a/Modules/Advert/moduleSrc/ORM/Clicks.cpp +++ b/Modules/Advert/moduleSrc/ORM/Clicks.cpp @@ -36,7 +36,7 @@ Clicks::Clicks() : QVariant IMPL_ORMGET(Clicks) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getUserID()}}, _filters); + this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getActorID()}}, _filters); auto fnTouchQuery = [](ORMSelectQuery &_query) { _query.innerJoin(tblBin::Name); diff --git a/Modules/Advert/moduleSrc/ORM/Props.cpp b/Modules/Advert/moduleSrc/ORM/Props.cpp index 4c125a84..1216fa2d 100644 --- a/Modules/Advert/moduleSrc/ORM/Props.cpp +++ b/Modules/Advert/moduleSrc/ORM/Props.cpp @@ -36,7 +36,7 @@ Props::Props() : QVariant IMPL_ORMGET(Props) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) - this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getUserID()}}, _filters); + this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getActorID()}}, _filters); auto fnTouchQuery = [](ORMSelectQuery &_query) { _query.innerJoin(tblBin::Name); @@ -47,8 +47,8 @@ QVariant IMPL_ORMGET(Props) { quint64 IMPL_ORMCREATE(Props) { if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_DELETE, this->moduleBaseName())) == false) - _createInfo.insert(tblBin::Fields::binID, APICALLBOOM_PARAM.getUserID()); -// this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getUserID()}}, _createInfo); + _createInfo.insert(tblBin::Fields::binID, APICALLBOOM_PARAM.getActorID()); +// this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getActorID()}}, _createInfo); return this->Create(CREATE_METHOD_ARGS_CALL_VALUES); } @@ -57,8 +57,8 @@ bool IMPL_ORMUPDATE(Props) { QVariantMap ExtraFilters; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_PATCH,this->moduleBaseName()))) - ExtraFilters.insert(tblBin::Fields::binID, APICALLBOOM_PARAM.getUserID()); -// this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getUserID()}}, ExtraFilters); + ExtraFilters.insert(tblBin::Fields::binID, APICALLBOOM_PARAM.getActorID()); +// this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getActorID()}}, ExtraFilters); return this->Update(UPDATE_METHOD_ARGS_CALL_VALUES, ExtraFilters); } @@ -66,8 +66,8 @@ bool IMPL_ORMUPDATE(Props) { bool IMPL_ORMDELETE(Props) { QVariantMap ExtraFilters; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_DELETE, this->moduleBaseName())) == false) - ExtraFilters.insert(tblBin::Fields::binID, APICALLBOOM_PARAM.getUserID()); -// this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getUserID()}}, ExtraFilters); + ExtraFilters.insert(tblBin::Fields::binID, APICALLBOOM_PARAM.getActorID()); +// this->setSelfFilters({{tblBin::Fields::binID, APICALLBOOM_PARAM.getActorID()}}, ExtraFilters); return this->DeleteByPks(DELETE_METHOD_ARGS_CALL_VALUES, ExtraFilters); } diff --git a/Modules/Ticketing/functionalTest/testTicketing.hpp b/Modules/Ticketing/functionalTest/testTicketing.hpp index a9bfe0d1..ba60a0dd 100644 --- a/Modules/Ticketing/functionalTest/testTicketing.hpp +++ b/Modules/Ticketing/functionalTest/testTicketing.hpp @@ -116,7 +116,7 @@ private slots: gEncodedJWT = Result.toString(); gJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gJWT).usrID() == gUserID); + QVERIFY(clsJWT(gJWT).actorID() == gUserID); QVERIFY(clsJWT(gJWT).usrStatus() == TAPI::enuUserStatus::Active); } @@ -133,7 +133,7 @@ private slots: gEncodedAdminJWT = Result.toString(); gAdminJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedAdminJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gAdminJWT).usrID() == gAdminUserID); + QVERIFY(clsJWT(gAdminJWT).actorID() == gAdminUserID); QVERIFY(clsJWT(gAdminJWT).usrStatus() == TAPI::enuUserStatus::Active); } diff --git a/Modules/Ticketing/functionalTest/testTicketingFixture.hpp b/Modules/Ticketing/functionalTest/testTicketingFixture.hpp index 0f098839..2cf22add 100644 --- a/Modules/Ticketing/functionalTest/testTicketingFixture.hpp +++ b/Modules/Ticketing/functionalTest/testTicketingFixture.hpp @@ -114,7 +114,7 @@ private slots: gEncodedJWT = Result.toString(); gJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gJWT).usrID() == gUserID); + QVERIFY(clsJWT(gJWT).actorID() == gUserID); QVERIFY(clsJWT(gJWT).usrStatus() == TAPI::enuUserStatus::Active); } @@ -131,7 +131,7 @@ private slots: gEncodedAdminJWT = Result.toString(); gAdminJWT = QJsonDocument::fromJson(QByteArray::fromBase64(gEncodedAdminJWT.split('.').at(1).toLatin1())).object(); - QVERIFY(clsJWT(gAdminJWT).usrID() == gAdminUserID); + QVERIFY(clsJWT(gAdminJWT).actorID() == gAdminUserID); QVERIFY(clsJWT(gAdminJWT).usrStatus() == TAPI::enuUserStatus::Active); } diff --git a/Modules/Ticketing/moduleSrc/ORM/TicketAttachments.cpp b/Modules/Ticketing/moduleSrc/ORM/TicketAttachments.cpp index d727ac9a..78baa6d6 100644 --- a/Modules/Ticketing/moduleSrc/ORM/TicketAttachments.cpp +++ b/Modules/Ticketing/moduleSrc/ORM/TicketAttachments.cpp @@ -43,8 +43,8 @@ QVariant IMPL_ORMGET(TicketAttachments) { // QString ExtraFilters; // if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) // ExtraFilters = QString ("( %1=%2 | %3=%4 | ( %5=NULL + %7=%8 )") -// .arg(tblTicketAttachments::Fields::tktTarget_usrID).arg(APICALLBOOM_PARAM.getUserID()) -// .arg(tblTicketAttachments::Fields::tktCreatedBy_usrID).arg(APICALLBOOM_PARAM.getUserID()) +// .arg(tblTicketAttachments::Fields::tktTarget_usrID).arg(APICALLBOOM_PARAM.getActorID()) +// .arg(tblTicketAttachments::Fields::tktCreatedBy_usrID).arg(APICALLBOOM_PARAM.getActorID()) // .arg(tblTicketAttachments::Fields::tktTarget_usrID) // .arg(tblTicketAttachments::Fields::tktType).arg((Targoman::API::TicketingModule::enuTicketType::toStr(Targoman::API::TicketingModule::enuTicketType::Broadcast))); @@ -53,8 +53,8 @@ QVariant IMPL_ORMGET(TicketAttachments) { clsCondition ExtraFilters = {}; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) ExtraFilters - .setCond({ tblTickets::Fields::tktTarget_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getUserID() }) - .orCond({ tblTickets::Fields::tktCreatedBy_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getUserID() }) + .setCond({ tblTickets::Fields::tktTarget_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getActorID() }) + .orCond({ tblTickets::Fields::tktCreatedBy_usrID, enuConditionOperator::Equal, APICALLBOOM_PARAM.getActorID() }) .orCond( clsCondition({ tblTickets::Fields::tktTarget_usrID, enuConditionOperator::Null }) .andCond({ tblTickets::Fields::tktType, diff --git a/Modules/Ticketing/moduleSrc/ORM/Tickets.cpp b/Modules/Ticketing/moduleSrc/ORM/Tickets.cpp index 0415bb16..296a6f85 100644 --- a/Modules/Ticketing/moduleSrc/ORM/Tickets.cpp +++ b/Modules/Ticketing/moduleSrc/ORM/Tickets.cpp @@ -66,7 +66,7 @@ QVariant Tickets::apiGET( TAPI::GroupBy_t _groupBy; bool _translate = true; - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); clsCondition ExtraFilters = {}; if (Authorization::hasPriv(APICALLBOOM_PARAM, this->privOn(EHTTP_GET, this->moduleBaseName())) == false) @@ -130,7 +130,7 @@ QVariant IMPL_REST_UPDATE(Tickets, setAsRead, ( APICALLBOOM_TYPE_JWT_IMPL &APICALLBOOM_PARAM, TAPI::PKsByPath_t _pksByPath )) { - quint64 CurrentUserID = APICALLBOOM_PARAM.getUserID(); + quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID(); TicketRead::instance().prepareFiltersList(); diff --git a/Modules/Ticketing/moduleSrc/Ticketing.cpp b/Modules/Ticketing/moduleSrc/Ticketing.cpp index 48425d11..48d5d6e1 100644 --- a/Modules/Ticketing/moduleSrc/Ticketing.cpp +++ b/Modules/Ticketing/moduleSrc/Ticketing.cpp @@ -129,7 +129,7 @@ quint64 Ticketing::insertTicket( } } - QueryCreateAttachments.execute(APICALLBOOM_PARAM.getUserID()); + QueryCreateAttachments.execute(APICALLBOOM_PARAM.getActorID()); } return TicketID; @@ -261,7 +261,7 @@ QVariant IMPL_REST_POST(Ticketing, fixtureSetup, ( { Gateways::NFSMetaInfoJsonKey::Path, ".../ticketing" }, })}, }) - .execute(APICALLBOOM_PARAM.getUserID()) + .execute(APICALLBOOM_PARAM.getActorID()) ; Result.insert("NFS", res); } @@ -283,7 +283,7 @@ QVariant IMPL_REST_POST(Ticketing, fixtureSetup, ( { Gateways::AWSS3MetaInfoJsonKey::AccessKey, "1" }, })}, }) - .execute(APICALLBOOM_PARAM.getUserID()) + .execute(APICALLBOOM_PARAM.getActorID()) ; Result.insert("S3", res); }