Compare commits

...
6 Commits
Author SHA1 Message Date
Gabriel Amorim 3d39affc61 Merge pull request #139 from dadosfera/fix/network-config-permissions
FIX: remove permission to delete VPNS
2022-09-16 11:55:50 -03:00
Gabriel Rosa 5d045b675c FIX: remove permission to delete VPNS 2022-09-15 09:48:37 -03:00
Gabriel Amorim bb61990f6e Merge pull request #138 from dadosfera/fix/permission-delete-connection
FIX: remove permission to delete connection
2022-09-15 08:50:41 -03:00
Gabriel Rosa 80442c509a FIX: remove permission to delete connection 2022-09-15 08:33:47 -03:00
Gabriel Amorim 8551239038 Merge pull request #137 from dadosfera/fix/update-user-email
FIX: update user email
2022-09-14 11:32:58 -03:00
Gabriel Rosa 4cf7c6e17b FIX: update user email 2022-09-14 10:18:03 -03:00
8 changed files with 90 additions and 81 deletions
+7 -7
View File
@@ -12,7 +12,7 @@
"dependencies": {
"@aws-sdk/client-secrets-manager": "^3.112.0",
"@dadosfera/dadosfera-logs": "^1.0.0-beta.3",
"@dadosfera/protospack-v2": "3.17.2",
"@dadosfera/protospack-v2": "3.17.5",
"@grpc/grpc-js": "^1.6.7",
"@grpc/proto-loader": "^0.6.13",
"@nestjs/common": "^8.4.7",
@@ -1726,9 +1726,9 @@
}
},
"node_modules/@dadosfera/protospack-v2": {
"version": "3.17.2",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.17.2.tgz",
"integrity": "sha512-N1hn7lIBWgc4JPEAdlQ3jt+++y61XYb9amDmgOUbfSt4803oSdAnCktrcxq3/0e/ZuSYm0qESOkKn0uNLDlGcg==",
"version": "3.17.5",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.17.5.tgz",
"integrity": "sha512-pVi9yCqCIngreW/z75jDqo7dladmN/z49K5m2vdd4ljS7yR21XicrCIg+YxSOwFga4wa3c8bI6WZ40Mp8ah8IA==",
"dependencies": {
"@grpc/grpc-js": "^1.6.7",
"rxjs": "^7.5.5",
@@ -12305,9 +12305,9 @@
}
},
"@dadosfera/protospack-v2": {
"version": "3.17.2",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.17.2.tgz",
"integrity": "sha512-N1hn7lIBWgc4JPEAdlQ3jt+++y61XYb9amDmgOUbfSt4803oSdAnCktrcxq3/0e/ZuSYm0qESOkKn0uNLDlGcg==",
"version": "3.17.5",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.17.5.tgz",
"integrity": "sha512-pVi9yCqCIngreW/z75jDqo7dladmN/z49K5m2vdd4ljS7yR21XicrCIg+YxSOwFga4wa3c8bI6WZ40Mp8ah8IA==",
"requires": {
"@grpc/grpc-js": "^1.6.7",
"rxjs": "^7.5.5",
+1 -1
View File
@@ -27,7 +27,7 @@
"dependencies": {
"@aws-sdk/client-secrets-manager": "^3.112.0",
"@dadosfera/dadosfera-logs": "^1.0.0-beta.3",
"@dadosfera/protospack-v2": "3.17.2",
"@dadosfera/protospack-v2": "3.17.5",
"@grpc/grpc-js": "^1.6.7",
"@grpc/proto-loader": "^0.6.13",
"@nestjs/common": "^8.4.7",
+21 -20
View File
@@ -125,16 +125,17 @@ export const PERMISSIONS_GROUPS = {
'es-es': 'Crear Source',
},
},
DELETE: {
seqid: 38,
claim: 'connection:delete',
usage: PermissionUsages.PUBLIC,
name: {
'pt-br': 'Excluir Fonte',
'en-us': 'Remove Source',
'es-s': 'Eliminar 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',
// },
// },
UPDATE: {
seqid: 39,
claim: 'connection:update',
@@ -165,16 +166,16 @@ export const PERMISSIONS_GROUPS = {
'es-es': 'Crear VPN',
},
},
DELETE: {
seqid: 36,
claim: 'network_config:delete',
usage: PermissionUsages.PUBLIC,
name: {
'pt-br': 'Excluir VPN',
'en-us': 'Remove VPN',
'es-es': 'Eliminar VPN',
},
},
// DELETE: {
// seqid: 36,
// claim: 'network_config:delete',
// usage: PermissionUsages.PUBLIC,
// name: {
// 'pt-br': 'Excluir VPN',
// 'en-us': 'Remove VPN',
// 'es-es': 'Eliminar VPN',
// },
// },
},
},
+20 -20
View File
@@ -103,29 +103,29 @@ export class ConnectionController {
return response;
}
@Delete('/:id')
@RequireAllPermissions(connectionPermissions.DELETE)
async deleteConnection(
@User() user: RequestUser,
@Param('id') id: string,
): Promise<ConnectionRes> {
this.logger.info('/connections - Delete Connection');
// @Delete('/:id')
// @RequireAllPermissions(connectionPermissions.DELETE)
// async deleteConnection(
// @User() user: RequestUser,
// @Param('id') id: string,
// ): Promise<ConnectionRes> {
// 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(
@@ -25,7 +25,10 @@ import {
UpdateNetworkConfigRes,
} from './dto/network-config';
import { FileInterceptor } from '@nestjs/platform-express';
import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum';
import { RequireAllPermissions } from 'src/authentication/authentication.decorator';
const networkConfigPermissions = PERMISSIONS_GROUPS.NETWORK_CONFIG.permissions;
@ApiTags('Network Config')
@Controller('network-config')
export class NetworkConfigController {
@@ -92,6 +95,7 @@ export class NetworkConfigController {
@Post()
@ApiOkResponse({ type: CreateNetworkConfigRes })
@RequireAllPermissions(networkConfigPermissions.CREATE)
@ApiConsumes('multipart/form-data')
@UseInterceptors(FileInterceptor('ovpn_file'))
async createNetworkConfigs(
@@ -111,36 +115,37 @@ export class NetworkConfigController {
});
}
@Patch(':id')
@ApiOkResponse({ type: UpdateNetworkConfigRes })
async updateNetworkConfig(
@User() user: RequestUser,
@Param('id') network_config_id: string,
@Body() body: UpdateNetworkConfigReq,
) {
this.logger.info('PATCH /network-config/:id', {
user: user.user_id,
customer: user.customer_name,
});
return this.networkConfigService.updateNetworkConfig(
body,
network_config_id,
);
}
// @Patch(':id')
// @ApiOkResponse({ type: UpdateNetworkConfigRes })
// @RequireAllPermissions(networkConfigPermissions.CREATE)
// async updateNetworkConfig(
// @User() user: RequestUser,
// @Param('id') network_config_id: string,
// @Body() body: UpdateNetworkConfigReq,
// ) {
// this.logger.info('PATCH /network-config/:id', {
// user: user.user_id,
// customer: user.customer_name,
// });
// return this.networkConfigService.updateNetworkConfig(
// body,
// network_config_id,
// );
// }
@Delete(':id')
@ApiOkResponse({ type: DeleteNetworkConfigRes })
async deleteNetworkConfig(
@User() user: RequestUser,
@Param('id') network_config_id: string,
) {
this.logger.info('DELETE /network-config', {
user: user.user_id,
customer: user.customer_name,
});
return this.networkConfigService.deleteNetworkConfig(network_config_id, {
customer_name: user.customer_name,
customer_id: user.customer_id,
});
}
// @Delete(':id')
// @ApiOkResponse({ type: DeleteNetworkConfigRes })
// async deleteNetworkConfig(
// @User() user: RequestUser,
// @Param('id') network_config_id: string,
// ) {
// this.logger.info('DELETE /network-config', {
// user: user.user_id,
// customer: user.customer_name,
// });
// return this.networkConfigService.deleteNetworkConfig(network_config_id, {
// customer_name: user.customer_name,
// customer_id: user.customer_id,
// });
// }
}
+2
View File
@@ -98,6 +98,8 @@ export class UpdateUserReq {
@ApiPropertyOptional()
name?: string;
@ApiPropertyOptional()
email?: string;
@ApiPropertyOptional()
jobTitle?: string;
@ApiPropertyOptional()
department?: string;
+2 -1
View File
@@ -100,7 +100,7 @@ export class UsersService implements OnModuleInit {
}
async updateUser(req: UpdateUserReq, id: string, customerId: string) {
const { department, hierarchy, jobTitle, name, roleNames } = req;
const { department, hierarchy, jobTitle, name, roleNames, email } = req;
if (roleNames) {
await this.setRoles({ roleNames, userId: id }, customerId);
}
@@ -112,6 +112,7 @@ export class UsersService implements OnModuleInit {
department,
hierarchy,
jobTitle,
email,
}),
);
return { user: this.adjustUsersPayload([user])[0] };
+1 -1
View File
File diff suppressed because one or more lines are too long