From 5f03f0c173de45a164e6f483d80b13b0043b6d1f Mon Sep 17 00:00:00 2001 From: simvalery Date: Sat, 1 Jun 2024 00:07:59 +0400 Subject: [PATCH] Fix for the 2.25.0 release (#3727) * update status code for tests * fix bottom margin for tools changing [skip ci] Signed-off-by: artembuslaev * Dockerfiles revised Signed-off-by: Alexander Pyatakov * node image replaced with the slim version Signed-off-by: Alexander Pyatakov * node version moved to arg Signed-off-by: Alexander Pyatakov * Dockerfiles has been revamped to reduce the size of the final images Signed-off-by: Alexander Pyatakov * Added/Modified .dockerignore files Signed-off-by: Alexander Pyatakov * Optimize caching with "COPY --link" Signed-off-by: Alexander Pyatakov * Run applications as a non-root user and use init:true for containers Signed-off-by: Alexander Pyatakov * Yarn cache directory defined as an argument Signed-off-by: Alexander Pyatakov * Yarn cache fix Signed-off-by: Alexander Pyatakov * Permissions changes Signed-off-by: Alexander Pyatakov * Base node image is changed to alpine Signed-off-by: Alexander Pyatakov * GITBOOK-136: Added Filebase docs * added bad_request const for status code * added publishing contract file script Signed-off-by: artembuslaev * fix: migrate to redict cache store * Revert "Merge branch 'develop' into feat/move-to-es-modules-develop" This reverts commit 6da2788a242fb0b421014850723e95038f5fae6c, reversing changes made to 0c8b8323e51d1a1b69f1c13ee366781f3211d344. * Revert "fix: merge with develop" This reverts commit 0c8b8323e51d1a1b69f1c13ee366781f3211d344, reversing changes made to 0fec16a844886453ae38a33bc25f897df3d43ea5. * Revert "Revert "fix: merge with develop"" This reverts commit 5610fa549cd6949e42ff4c0d6d8159b0f331700e. * Revert "Revert "Merge branch 'develop' into feat/move-to-es-modules-develop"" This reverts commit c48aa0f5f176f1e3cb018a4f27c3316adee52a61. * added nfts limit in contracts Signed-off-by: Artem Buslaev * upd contracts [skip ci] Signed-off-by: Artem Buslaev * fix script [skip ci] Signed-off-by: Artem Buslaev * GITBOOK-137: Updated Changing Tools in UI section * Update readme.md of ML readme * remove output [skip ci] Signed-off-by: Artem Buslaev * fix Signed-off-by: Artem Buslaev * GITBOOK-139: Added section on how to deploy contracts using your own account * Update readme.md * GITBOOK-140: Added Atma Scope 3 policy demo * GITBOOK-142: Added Dovu MMCM * update iii.f [skip ci] Signed-off-by: Artem Buslaev * feat: performance interceptor * cache-endpoints Signed-off-by: simvalery Signed-off-by: simvalery * update policies [skip ci] Signed-off-by: Artem Buslaev * fix: extentions gulp files in description dockerfiles * update policies [skip ci] Signed-off-by: Artem Buslaev * feat: wrap endpoinds in cache * GITBOOK-143: added ExternalDataBlock details * feat: use cache with apply decorators * fix: file name import * fix: get user only if auth token exist * feat: add perf hooks in performance interceptor * fix: add express flag for projects/properties route * setup user profile Signed-off-by: simvalery Signed-off-by: simvalery * sign with fireblocks Signed-off-by: simvalery Signed-off-by: simvalery * user fireblocks config Signed-off-by: simvalery Signed-off-by: simvalery * fix serials column Signed-off-by: Artem Buslaev * remove res where it possible and add res.locals.data * GITBOOK-144: Added Changing of Tools during Policy import APIs added * fix fireblocks sign bug Signed-off-by: simvalery Signed-off-by: simvalery * add ui validators, add exception Signed-off-by: simvalery Signed-off-by: simvalery * temp fix validators Signed-off-by: simvalery Signed-off-by: simvalery * GITBOOK-145: Added youtube demo video for PWRM0002 * GITBOOK-146: Updated Guardian Introduction * fix: remove cache from policies/:policyId/groups * fix Signed-off-by: simvalery Signed-off-by: simvalery * fix Signed-off-by: simvalery Signed-off-by: simvalery * Policy Preview/Import performance optimisations Signed-off-by: Alexander Pyatakov * fixed fields parsing for compare Signed-off-by: Alexander Pyatakov * parseConditions function improvements Signed-off-by: Alexander Pyatakov * fix generate xlsx Signed-off-by: Stepan Kiryakov * GITBOOK-147: Made some minor corrections * test Signed-off-by: simvalery Signed-off-by: simvalery * added policy data migration Signed-off-by: Artem Buslaev * [skip ci] Add swagger.yaml * fix Signed-off-by: Artem Buslaev * fix Signed-off-by: Artem Buslaev * fix lint Signed-off-by: Artem Buslaev * remove types/mime resolution Signed-off-by: simvalery Signed-off-by: simvalery * fix Signed-off-by: simvalery Signed-off-by: simvalery * Add files via upload * fix signing Signed-off-by: simvalery Signed-off-by: simvalery * fix linting Signed-off-by: simvalery Signed-off-by: simvalery * fix autocomplete Signed-off-by: simvalery Signed-off-by: simvalery * remove singleton from fireblocks-helper.ts Signed-off-by: simvalery Signed-off-by: simvalery * fix Signed-off-by: simvalery Signed-off-by: simvalery * docs: add instruction for launch cache container in readme file * bump version Signed-off-by: simvalery Signed-off-by: simvalery * [skip ci] Add swagger.yaml * GITBOOK-148: Added Live Project Data Migration UI * GITBOOK-149: Fireblocks Docs added * added migrating retire pools and dynamic tokens Signed-off-by: Artem Buslaev * [skip ci] Add swagger.yaml * fix Signed-off-by: Artem Buslaev * GITBOOK-150: ACM0001 guide added * fix lint Signed-off-by: Artem Buslaev * Update readme.md of ACM0001 * fix Signed-off-by: Artem Buslaev * GITBOOK-151: Added migration policy data APIs * hotfix: remove cache for contract routes * GITBOOK-152: Added redict in Prerequisites * GITBOOK-153: Added Prerequisites * GITBOOK-154: Added Token template to migration * GITBOOK-155: Added fireblocks note * hotfix/remove-cache-from-tags-schemas * GITBOOK-156: Updated roadmap * GITBOOK-157: Updated roadmap * fix: remove cache from navigation * GITBOOK-158: Made some changes in SD * feat:basic fastify solution * feat: add body parser for json and binary/octet-stream and send method * feat: implement interceptor for multipart formdata * refactor: put same names as base nest * fix cache document id Signed-off-by: Stepan Kiryakov * fix cache document id Signed-off-by: Stepan Kiryakov * fix cache document id Signed-off-by: Stepan Kiryakov * GITBOOK-159: made some minor corrections * GITBOOK-160: updated extractdatablock * fix: error status if token is not correct * bump version Signed-off-by: simvalery Signed-off-by: simvalery * [skip ci] Add swagger.yaml * fix: size of limit json to 1gb * GITBOOK-161: Updated Live Project Data UI * update mamual tests flow Signed-off-by: simvalery Signed-off-by: simvalery * fix: auth accross decorator in get account * feat: add option ignoreTrailingSlash in fastify adapter * [skip ci] Add swagger.yaml * fix: remove local data for cache from contracts * fix: remove local data for cache from tags schemas * GITBOOK-162: Added note in Topics Architecture * fix: export strime for schema file * update api workflows (#3640) Signed-off-by: simvalery * fix: setHeader to header for fastify * fix: linter errors * fix: req body is undefined for logger * gzip compression enabled for web-proxy Signed-off-by: Alexander Pyatakov * fix: multipart intercepter for artifats * GITBOOK-163: Updated Fireblocks UI screens * GITBOOK-164: Removed Fireblocks note * fix: sypress 500 error instead 400 in artifact * remove port sharing from cache container Signed-off-by: simvalery Signed-off-by: simvalery * GITBOOK-165: Updated tools for AMS-II.G * GITBOOK-166: Corrected gold Standard policy * GITBOOK-167: Updated Verra titles * GITBOOK-168: updated VM0017 title * GITBOOK-169: updated Verra * GITBOOK-171: updated grid spelling * GITBOOK-172: correcting grid spelling * GITBOOK-173: Updated High level architecture * data comparation Signed-off-by: simvalery Signed-off-by: simvalery * fix 3449 Signed-off-by: simvalery Signed-off-by: simvalery * GITBOOK-174: fireblocks diagram updated * add api-version Signed-off-by: simvalery Signed-off-by: simvalery * [skip ci] Add swagger.yaml * fix swagger generated files Signed-off-by: simvalery Signed-off-by: simvalery * [skip ci] Add swagger.yaml * fix 3449 Signed-off-by: simvalery Signed-off-by: simvalery * GITBOOK-174: fireblocks diagram updated * fix swagger generated files Signed-off-by: simvalery Signed-off-by: simvalery * fix swagger Signed-off-by: simvalery Signed-off-by: simvalery * [skip ci] Add swagger.yaml * fix labels Signed-off-by: simvalery Signed-off-by: simvalery * fix labels Signed-off-by: simvalery Signed-off-by: simvalery * fix irec7 comparation Signed-off-by: simvalery Signed-off-by: simvalery * fix irec5 comparison Signed-off-by: simvalery Signed-off-by: simvalery * fix crash Signed-off-by: simvalery Signed-off-by: simvalery * fix ui Signed-off-by: simvalery Signed-off-by: simvalery * fix sizing Signed-off-by: simvalery Signed-off-by: simvalery * fix schema title Signed-off-by: simvalery Signed-off-by: simvalery * status code added * fix lint Signed-off-by: simvalery Signed-off-by: simvalery * GITBOOK-175: Added VP Document Comparison for projects * GITBOOK-176: Added VP Compare in Projects docs * GITBOOK-177: Added Methane Emission GS demo guide * GITBOOK-178: Added operations section for Fireblocks * Revamp Guardian user/roles and permissions model (#3717) Revamp Guardian user/roles and permissions model --------- Signed-off-by: Stepan Kiryakov Co-authored-by: envision-ci-agent * fix: issue-3447-redundant-fields-in-session-api (#3664) Signed-off-by: Ihar Tsykala Co-authored-by: Ihar * fix connection refused error Signed-off-by: simvalery Signed-off-by: simvalery * fix application-events service Signed-off-by: simvalery Signed-off-by: simvalery * fix ipfs get file Signed-off-by: simvalery Signed-off-by: simvalery * [skip ci] Add swagger.yaml * fix upload in ipfs from dryRun mode Signed-off-by: simvalery Signed-off-by: simvalery * fix download in ipfs from dryRun mode Signed-off-by: simvalery Signed-off-by: simvalery * fix gridfs bug Signed-off-by: simvalery Signed-off-by: simvalery * fix gridfs bug Signed-off-by: simvalery Signed-off-by: simvalery * Feature/2629 upd (#3720) * add indexer Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * fix Signed-off-by: Stepan Kiryakov * add services Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update elastic Signed-off-by: Stepan Kiryakov * add page templates Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update Signed-off-by: Stepan Kiryakov * update indexer [skip ci] Signed-off-by: Artem Buslaev * update yarn lock [skip ci] Signed-off-by: Artem Buslaev * fix [skip ci] Signed-off-by: Artem Buslaev * fix [skip ci] Signed-off-by: Artem Buslaev * fix [skip ci] Signed-off-by: Artem Buslaev * fix swagger [skip ci] Signed-off-by: Artem Buslaev --------- Signed-off-by: Stepan Kiryakov Signed-off-by: Artem Buslaev Co-authored-by: Stepan Kiryakov * bump version Signed-off-by: simvalery Signed-off-by: simvalery * [skip ci] Add swagger.yaml * update default masks [skip ci] Signed-off-by: Artem Buslaev * Revamp Guardian user/roles and permissions model (#3722) Add messages * GITBOOK-179: Added Step by step to GS methodology * Create readme.md of Methane Emission Reduction by Adjusted Water Management Practice in Rice Cultivation Signed-off-by: prernaadev01 * bump version Signed-off-by: simvalery Signed-off-by: simvalery * add gs policy Signed-off-by: simvalery Signed-off-by: simvalery * Add files via upload Signed-off-by: prernaadev01 * Update readme.md of Rice Cultivation Signed-off-by: prernaadev01 * GITBOOK-180: Indexer User Guide added * GITBOOK-181: Added Roles & Permissions section * GITBOOK-182: corrected docs * fix session response Signed-off-by: simvalery Signed-off-by: simvalery * fix session response Signed-off-by: simvalery Signed-off-by: simvalery * remove unnesessary cache Signed-off-by: simvalery Signed-off-by: simvalery * remove unnesessary cache Signed-off-by: simvalery Signed-off-by: simvalery --------- Signed-off-by: artembuslaev Signed-off-by: Alexander Pyatakov Signed-off-by: Artem Buslaev Signed-off-by: simvalery Signed-off-by: Stepan Kiryakov Signed-off-by: Ihar Tsykala Signed-off-by: prernaadev01 Co-authored-by: Celiant Co-authored-by: artembuslaev Co-authored-by: Alexander Pyatakov Co-authored-by: prernaa.agarwal Co-authored-by: Ihar Co-authored-by: Stepan Kiryakov Co-authored-by: envision-ci-agent Co-authored-by: Ihar Tsykala --- api-gateway/src/api/service/account.ts | 10 +++++----- api-gateway/src/api/service/demo.ts | 6 +++--- auth-service/src/api/account-service.ts | 7 ++++--- auth-service/src/constants/user.ts | 2 ++ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/api-gateway/src/api/service/account.ts b/api-gateway/src/api/service/account.ts index ad16cc007a..058baf798e 100644 --- a/api-gateway/src/api/service/account.ts +++ b/api-gateway/src/api/service/account.ts @@ -3,9 +3,9 @@ import { Permissions, PolicyType, SchemaEntity, UserRole } from '@guardian/inter import { ClientProxy } from '@nestjs/microservices'; import { Body, Controller, Get, Headers, HttpCode, HttpException, HttpStatus, Inject, Post, Req } from '@nestjs/common'; import { ApiBearerAuth, ApiExtraModels, ApiInternalServerErrorResponse, ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger'; -import { AccountsResponseDTO, AccountsSessionResponseDTO, AggregatedDTOItem, BalanceResponseDTO, LoginUserDTO, RegisterUserDTO, InternalServerErrorDTO } from '#middlewares'; -import { AuthUser, checkPermission, Auth } from '#auth'; -import { Users, PolicyEngine, Guardians, UseCache, InternalException, EntityOwner } from '#helpers'; +import { AccountsResponseDTO, AccountsSessionResponseDTO, AggregatedDTOItem, BalanceResponseDTO, InternalServerErrorDTO, LoginUserDTO, RegisterUserDTO } from '#middlewares'; +import { Auth, AuthUser, checkPermission } from '#auth'; +import { EntityOwner, Guardians, InternalException, PolicyEngine, UseCache, Users } from '#helpers'; import { PolicyListResponse } from '../../entities/policy.js'; import { StandardRegistryAccountResponse } from '../../entities/account.js'; import { ApplicationEnvironment } from '../../environment.js'; @@ -231,7 +231,7 @@ export class AccountApi { type: InternalServerErrorDTO, }) @ApiExtraModels(AccountsResponseDTO, InternalServerErrorDTO) - @UseCache() + // @UseCache() @HttpCode(HttpStatus.OK) async getStandardRegistries(): Promise { try { @@ -265,7 +265,7 @@ export class AccountApi { type: InternalServerErrorDTO, }) @ApiExtraModels(AggregatedDTOItem, InternalServerErrorDTO) - @UseCache() + // @UseCache() @HttpCode(HttpStatus.OK) async getAggregatedStandardRegistries(): Promise { const engineService = new PolicyEngine(); diff --git a/api-gateway/src/api/service/demo.ts b/api-gateway/src/api/service/demo.ts index 031fb7e82f..e81449a4d8 100644 --- a/api-gateway/src/api/service/demo.ts +++ b/api-gateway/src/api/service/demo.ts @@ -3,8 +3,8 @@ import { Controller, Get, HttpCode, HttpStatus } from '@nestjs/common'; import { ApiExtraModels, ApiInternalServerErrorResponse, ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger'; import { Permissions, TaskAction } from '@guardian/interfaces'; import { InternalServerErrorDTO, RegisteredUsersDTO, TaskDTO } from '#middlewares'; -import { AuthUser, Auth } from '#auth'; -import { ServiceError, NewTask, TaskManager, Users, Guardians, UseCache, InternalException } from '#helpers'; +import { Auth, AuthUser } from '#auth'; +import { Guardians, InternalException, NewTask, ServiceError, TaskManager, Users } from '#helpers'; @Controller('demo') @ApiTags('demo') @@ -26,7 +26,7 @@ export class DemoApi { type: InternalServerErrorDTO }) @ApiExtraModels(RegisteredUsersDTO, InternalServerErrorDTO) - @UseCache() + // @UseCache() @HttpCode(HttpStatus.OK) async registeredUsers(): Promise { const users = new Users(); diff --git a/auth-service/src/api/account-service.ts b/auth-service/src/api/account-service.ts index d8cfc4db56..2f7f668b72 100644 --- a/auth-service/src/api/account-service.ts +++ b/auth-service/src/api/account-service.ts @@ -9,7 +9,6 @@ import { DataBaseHelper, Logger, MessageError, MessageResponse, NatsService, Pro import { AuditDefaultPermission, AuthEvents, - OldRoles, GenerateUUIDv4, IGenerateTokenMessage, IGenerateTokenResponse, @@ -26,6 +25,7 @@ import { IStandardRegistryUserResponse, IUpdateUserMessage, IUser, + OldRoles, SRDefaultPermission, UserDefaultPermission, UserRole @@ -125,14 +125,15 @@ export class AccountService extends NatsService { } const user = await new DataBaseHelper(User).findOne({ username: decryptedToken.username }); + const puser = setDefaultPermissions(user) const userRequiredProps = {} for (const prop of Object.values(USER_REQUIRED_PROPS)) { - userRequiredProps[prop] = user[prop]; + userRequiredProps[prop] = puser[prop]; } - return new MessageResponse(setDefaultPermissions(user)); + return new MessageResponse(userRequiredProps); } catch (error) { return new MessageError(error); } diff --git a/auth-service/src/constants/user.ts b/auth-service/src/constants/user.ts index 6a31717136..688d512346 100644 --- a/auth-service/src/constants/user.ts +++ b/auth-service/src/constants/user.ts @@ -7,4 +7,6 @@ export const REQUIRED_PROPS = { HEDERA_ACCOUNT_ID: 'hederaAccountId', ROLE: 'role', ID: 'id', + PERMISSIONS: 'permissions', + PERMISSION_GROUP: 'permissionsGroup' };