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' };