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