From 28280dca8df501d496509f5ea345017b86d8bd58 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Tue, 4 Oct 2022 14:46:52 -0300 Subject: [PATCH 1/2] FIX: Delete connections permission --- src/authentication/permissions.enum.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/authentication/permissions.enum.ts b/src/authentication/permissions.enum.ts index cc53a2b..edcc90f 100644 --- a/src/authentication/permissions.enum.ts +++ b/src/authentication/permissions.enum.ts @@ -125,17 +125,16 @@ export const PERMISSIONS_GROUPS = { 'es-es': 'Crear Source', }, }, - //TODO descomentar quando tiver ok o DELETE de conexões - // DELETE: { - // seqid: 38, - // claim: 'connection:delete', - // usage: PermissionUsages.PUBLIC, - // name: { - // 'pt-br': 'Excluir Fonte', - // 'en-us': 'Remove Source', - // 'es-s': 'Eliminar Source', - // }, - // }, + DELETE: { + seqid: 38, + claim: 'connection:delete', + usage: PermissionUsages.INTERNAL, + name: { + 'pt-br': 'Excluir Fonte', + 'en-us': 'Remove Source', + 'es-s': 'Eliminar Source', + }, + }, UPDATE: { seqid: 39, claim: 'connection:update', From b311a84bde838ef5b20052a809a52ef039d24b41 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Tue, 4 Oct 2022 15:22:43 -0300 Subject: [PATCH 2/2] FIX: delete route reimplemented --- .../connection/connection.controller.ts | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/modules/connection/connection.controller.ts b/src/modules/connection/connection.controller.ts index a86904c..1d614bd 100644 --- a/src/modules/connection/connection.controller.ts +++ b/src/modules/connection/connection.controller.ts @@ -105,29 +105,29 @@ export class ConnectionController { return response; } - // @Delete('/:id') - // @RequireAllPermissions(connectionPermissions.DELETE) - // async deleteConnection( - // @User() user: RequestUser, - // @Param('id') id: string, - // ): Promise { - // this.logger.info('/connections - Delete Connection'); + @Delete('/:id') + @RequireAllPermissions(connectionPermissions.DELETE) + async deleteConnection( + @User() user: RequestUser, + @Param('id') id: string, + ): Promise { + this.logger.info('/connections - Delete Connection'); - // const { user_id, customer_id, customer_name, username } = user; - // const metadata = PackTheMetadata({ - // user_id, - // customer_id, - // customer_name, - // username, - // }); + const { user_id, customer_id, customer_name, username } = user; + const metadata = PackTheMetadata({ + user_id, + customer_id, + customer_name, + username, + }); - // const response: any = await this.clientService.deleteConnection({ - // body: { id }, - // metadata, - // }); + const response: any = await this.clientService.deleteConnection({ + body: { id }, + metadata, + }); - // return response; - // } + return response; + } @Get() async getAllConnections(