From 077949bae72b4bc59efc0ed6173693ef774f2318 Mon Sep 17 00:00:00 2001 From: sanjay-k1910 Date: Thu, 22 Feb 2024 18:24:58 +0530 Subject: [PATCH] fix: search and sorting issue in ecosystem member list API Signed-off-by: sanjay-k1910 Signed-off-by: bhavanakarwade --- .../src/authz/guards/ecosystem-roles.guard.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/api-gateway/src/authz/guards/ecosystem-roles.guard.ts b/apps/api-gateway/src/authz/guards/ecosystem-roles.guard.ts index 89b32a9fb..099f1146a 100644 --- a/apps/api-gateway/src/authz/guards/ecosystem-roles.guard.ts +++ b/apps/api-gateway/src/authz/guards/ecosystem-roles.guard.ts @@ -50,23 +50,17 @@ export class EcosystemRolesGuard implements CanActivate { const ecosystemOrgData = await this.ecosystemService.fetchEcosystemOrg(ecosystemId, orgId); if (!ecosystemOrgData) { - throw new ForbiddenException(ResponseMessages.organisation.error.orgDoesNotMatch); + throw new ForbiddenException('Organization does not match'); } user.ecosystemOrgRole = ecosystemOrgData['ecosystemRole']['name']; if (!user.ecosystemOrgRole) { - throw new ForbiddenException(ResponseMessages.ecosystem.error.ecosystemRoleNotMatch); + throw new ForbiddenException('Ecosystem role not match'); } } else { - throw new BadRequestException(ResponseMessages.ecosystem.error.orgEcoIdRequired); - } - - // Sending user friendly message if a user attempts to access an API that is inaccessible to their role - const roleAccess = requiredRoles.some((role) => user.ecosystemOrgRole === role); - if (!roleAccess) { - throw new ForbiddenException(ResponseMessages.organisation.error.roleNotMatch, { cause: new Error(), description: ResponseMessages.errorMessages.forbidden }); + throw new BadRequestException('organization & ecosystem is required'); } // Sending user friendly message if a user attempts to access an API that is inaccessible to their role