mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-15 06:49:08 +00:00
Compare commits
20
Commits
@@ -49,5 +49,8 @@ releases:
|
|||||||
value: dea2c27f-0973-4588-a2e0-9e31b64c7ffd
|
value: dea2c27f-0973-4588-a2e0-9e31b64c7ffd
|
||||||
- name: replicaCount
|
- name: replicaCount
|
||||||
value: 1
|
value: 1
|
||||||
# - name: maestro.restricted_ip
|
# 10.70.0.0/16 internal network
|
||||||
# value: "177.52.172.0/24,189.84.160.157/32,186.237.171.146/32,10.70.1.0/24"
|
# 137.131.167.254/32 loadbalancer
|
||||||
|
# 159.112.184.81/32 cluster ip for the uptime request ingest
|
||||||
|
- name: maestro.restricted_ip
|
||||||
|
value: "177.52.172.0/24, 189.84.160.157/32, 186.237.171.146/32, 137.131.167.254/32, 10.70.0.0/16, 159.112.184.81/32, 10.244.0.0/16"
|
||||||
|
|||||||
@@ -27,4 +27,4 @@ charts:
|
|||||||
- name: resources
|
- name: resources
|
||||||
value: null
|
value: null
|
||||||
- name: maestro.restricted_ip
|
- name: maestro.restricted_ip
|
||||||
value: "137.131.167.254/32,10.70.0.0/16,163.176.242.27/32"
|
value: "137.131.167.254/32, 10.70.0.0/16, 159.112.184.81/32, 10.244.0.0/16"
|
||||||
|
|||||||
@@ -116,6 +116,44 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
IMPORT_FILES: {
|
||||||
|
title: {
|
||||||
|
'pt-br': 'Coletar | Importar arquivos',
|
||||||
|
'en-us': 'Collect | Import files',
|
||||||
|
'es-es': 'Colecta | Importar archivos',
|
||||||
|
},
|
||||||
|
permissions: {
|
||||||
|
VIEW: {
|
||||||
|
seqid: 48,
|
||||||
|
claim: 'import-file:view',
|
||||||
|
usage: PermissionUsages.PUBLIC,
|
||||||
|
name: {
|
||||||
|
'pt-br': 'Importar arquivos',
|
||||||
|
'en-us': 'Import files',
|
||||||
|
'es-es': 'Importar archivos',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
AI_CHAT: {
|
||||||
|
title: {
|
||||||
|
'pt-br': 'AutodriveDDF',
|
||||||
|
'en-us': 'AutodriveDDF',
|
||||||
|
'es-es': 'AutodriveDDF',
|
||||||
|
},
|
||||||
|
permissions: {
|
||||||
|
VIEW: {
|
||||||
|
seqid: 49,
|
||||||
|
claim: 'ai-chat:view',
|
||||||
|
usage: PermissionUsages.PUBLIC,
|
||||||
|
name: {
|
||||||
|
'pt-br': 'AutodriveDDF',
|
||||||
|
'en-us': 'AutodriveDDF',
|
||||||
|
'es-es': 'AutodriveDDF',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
CONNECTION: {
|
CONNECTION: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Coletar | Fontes de dados',
|
'pt-br': 'Coletar | Fontes de dados',
|
||||||
|
|||||||
@@ -406,11 +406,14 @@ class CatalogService implements OnModuleInit {
|
|||||||
|
|
||||||
const roles = [];
|
const roles = [];
|
||||||
const users = [];
|
const users = [];
|
||||||
for (const role_id of data_asset.roles) {
|
const data_asset_roles = data_asset?.roles || []
|
||||||
|
for (const role_id of data_asset_roles) {
|
||||||
const role = customer_roles.find((r) => r.id === role_id);
|
const role = customer_roles.find((r) => r.id === role_id);
|
||||||
if (role) roles.push({ id: role.id, name: role.name });
|
if (role) roles.push({ id: role.id, name: role.name });
|
||||||
}
|
}
|
||||||
for (const user_id of data_asset.users) {
|
|
||||||
|
const data_asset_users = data_asset?.users || []
|
||||||
|
for (const user_id of data_asset_users) {
|
||||||
const user = customer_users.find((r) => r.id === user_id);
|
const user = customer_users.find((r) => r.id === user_id);
|
||||||
if (user) users.push({ id: user.id, username: user.username });
|
if (user) users.push({ id: user.id, username: user.username });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
|||||||
import {
|
import {
|
||||||
AuthenticateCondition,
|
AuthenticateCondition,
|
||||||
Authenticated,
|
Authenticated,
|
||||||
|
RequireSomePermission,
|
||||||
} from 'src/decorators/authentication.decorator';
|
} from 'src/decorators/authentication.decorator';
|
||||||
import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum';
|
import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum';
|
||||||
import { PipelinesService } from './pipelines.service';
|
import { PipelinesService } from './pipelines.service';
|
||||||
@@ -13,26 +14,6 @@ import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator';
|
|||||||
@ApiTags('Pipelines')
|
@ApiTags('Pipelines')
|
||||||
@Controller('pipelines')
|
@Controller('pipelines')
|
||||||
@Authenticated()
|
@Authenticated()
|
||||||
@AuthenticateCondition((req, user) => {
|
|
||||||
let action;
|
|
||||||
|
|
||||||
switch (req.method) {
|
|
||||||
case 'POST':
|
|
||||||
action = 'CREATE';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PUT':
|
|
||||||
action = 'UPDATE';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
action = req.method;
|
|
||||||
}
|
|
||||||
|
|
||||||
return user.permissions.includes(
|
|
||||||
PERMISSIONS_GROUPS.PIPELINE.permissions[action].seqid,
|
|
||||||
);
|
|
||||||
})
|
|
||||||
export class PipelinesController {
|
export class PipelinesController {
|
||||||
logger: DadosferaLogger;
|
logger: DadosferaLogger;
|
||||||
constructor(
|
constructor(
|
||||||
@@ -44,6 +25,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('start/:id')
|
@Post('start/:id')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE)
|
||||||
@ApiOperation({
|
@ApiOperation({
|
||||||
deprecated: true,
|
deprecated: true,
|
||||||
description:
|
description:
|
||||||
@@ -71,6 +53,7 @@ export class PipelinesController {
|
|||||||
description:
|
description:
|
||||||
'This method is deprecated. Please use route /pipelinesV2/:id/status instead',
|
'This method is deprecated. Please use route /pipelinesV2/:id/status instead',
|
||||||
})
|
})
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW, PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
async getPipelineStatus(@Body() body, @Param('id') id: string) {
|
async getPipelineStatus(@Body() body, @Param('id') id: string) {
|
||||||
body.id = id;
|
body.id = id;
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
AuthenticateCondition,
|
AuthenticateCondition,
|
||||||
RequireAllPermissions,
|
RequireAllPermissions,
|
||||||
|
RequireSomePermission,
|
||||||
} from 'src/decorators/authentication.decorator';
|
} from 'src/decorators/authentication.decorator';
|
||||||
import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum';
|
import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum';
|
||||||
import { PipelinesService } from './pipelines.service';
|
import { PipelinesService } from './pipelines.service';
|
||||||
@@ -52,30 +53,6 @@ import { ApiInternalOnlyEndpoint } from 'src/decorators/swagger.decorator';
|
|||||||
@ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }])
|
@ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }])
|
||||||
@UseFilters(new GrpcToHttpExceptionFilter())
|
@UseFilters(new GrpcToHttpExceptionFilter())
|
||||||
@Controller('pipelinesV2')
|
@Controller('pipelinesV2')
|
||||||
@AuthenticateCondition((req, user) => {
|
|
||||||
let action;
|
|
||||||
|
|
||||||
switch (req.method) {
|
|
||||||
case 'POST':
|
|
||||||
action = 'CREATE';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PUT':
|
|
||||||
action = 'UPDATE';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PATCH':
|
|
||||||
action = 'UPDATE';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
action = req.method;
|
|
||||||
}
|
|
||||||
|
|
||||||
return user.permissions.includes(
|
|
||||||
PERMISSIONS_GROUPS.PIPELINE.permissions[action].seqid,
|
|
||||||
);
|
|
||||||
})
|
|
||||||
export class PipelinesController {
|
export class PipelinesController {
|
||||||
logger: DadosferaLogger;
|
logger: DadosferaLogger;
|
||||||
constructor(
|
constructor(
|
||||||
@@ -88,6 +65,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('monitoring-dashboard')
|
@Get('monitoring-dashboard')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
async getMonitoringDashboard(@User() user: RequestUser) {
|
async getMonitoringDashboard(@User() user: RequestUser) {
|
||||||
this.logger.info('PipelinesController - getMonitoringDashboard', { user });
|
this.logger.info('PipelinesController - getMonitoringDashboard', { user });
|
||||||
|
|
||||||
@@ -100,6 +78,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE)
|
||||||
@ApiCreatedResponse({ type: IPipelineV2 })
|
@ApiCreatedResponse({ type: IPipelineV2 })
|
||||||
async create(
|
async create(
|
||||||
@Language() language: LanguageEnum,
|
@Language() language: LanguageEnum,
|
||||||
@@ -126,6 +105,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW, PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
async findAll(
|
async findAll(
|
||||||
@User() user: RequestUser,
|
@User() user: RequestUser,
|
||||||
@Language() language: LanguageEnum,
|
@Language() language: LanguageEnum,
|
||||||
@@ -150,6 +130,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('/download-logs')
|
@Get('/download-logs')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
async downloadLogs(
|
async downloadLogs(
|
||||||
@User() user: RequestUser,
|
@User() user: RequestUser,
|
||||||
@Language() language: LanguageEnum,
|
@Language() language: LanguageEnum,
|
||||||
@@ -180,6 +161,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/config')
|
@Get(':id/config')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW,PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
async getPipelineproperties(
|
async getPipelineproperties(
|
||||||
@Language() language: LanguageEnum,
|
@Language() language: LanguageEnum,
|
||||||
@User() user: RequestUser,
|
@User() user: RequestUser,
|
||||||
@@ -191,6 +173,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/objects')
|
@Get(':id/objects')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
async getPipelineObjects(
|
async getPipelineObjects(
|
||||||
@Language() language: LanguageEnum,
|
@Language() language: LanguageEnum,
|
||||||
@User() user: RequestUser,
|
@User() user: RequestUser,
|
||||||
@@ -202,6 +185,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/status')
|
@Get(':id/status')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW, PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
async getPipelineStatus(@Body() body, @Param('id') id: string) {
|
async getPipelineStatus(@Body() body, @Param('id') id: string) {
|
||||||
body.id = id;
|
body.id = id;
|
||||||
|
|
||||||
@@ -216,6 +200,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('/:id')
|
@Get('/:id')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW, PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
async findOne(
|
async findOne(
|
||||||
@Language() language: LanguageEnum,
|
@Language() language: LanguageEnum,
|
||||||
@User() user: RequestUser,
|
@User() user: RequestUser,
|
||||||
@@ -258,6 +243,7 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Patch('/:id')
|
@Patch('/:id')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE)
|
||||||
async update(
|
async update(
|
||||||
@Language() language: LanguageEnum,
|
@Language() language: LanguageEnum,
|
||||||
@Body() updatePipelineDto,
|
@Body() updatePipelineDto,
|
||||||
@@ -297,6 +283,7 @@ export class PipelinesController {
|
|||||||
deprecated: true,
|
deprecated: true,
|
||||||
description: 'This method is deprecated. Please use PATCH instead',
|
description: 'This method is deprecated. Please use PATCH instead',
|
||||||
})
|
})
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW, PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE)
|
||||||
async updateDeprecated(
|
async updateDeprecated(
|
||||||
@Language() language: LanguageEnum,
|
@Language() language: LanguageEnum,
|
||||||
@Body() updatePipelineDto,
|
@Body() updatePipelineDto,
|
||||||
@@ -312,6 +299,7 @@ export class PipelinesController {
|
|||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
@ApiNoContentResponse()
|
@ApiNoContentResponse()
|
||||||
@HttpCode(HttpStatus.NO_CONTENT)
|
@HttpCode(HttpStatus.NO_CONTENT)
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.DELETE)
|
||||||
async delete(@Param('id') id: string, @User() user: RequestUser) {
|
async delete(@Param('id') id: string, @User() user: RequestUser) {
|
||||||
this.logger.info('PipelinesController - delete', { user });
|
this.logger.info('PipelinesController - delete', { user });
|
||||||
const metadata = PackTheMetadata({
|
const metadata = PackTheMetadata({
|
||||||
@@ -325,7 +313,7 @@ export class PipelinesController {
|
|||||||
|
|
||||||
@ApiInternalOnlyEndpoint()
|
@ApiInternalOnlyEndpoint()
|
||||||
@Post('/init-upload')
|
@Post('/init-upload')
|
||||||
@RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE)
|
@RequireAllPermissions(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW)
|
||||||
async initUploadFile(
|
async initUploadFile(
|
||||||
@User() user: RequestUser,
|
@User() user: RequestUser,
|
||||||
@Body() body: IInitUploadCSVFile,
|
@Body() body: IInitUploadCSVFile,
|
||||||
@@ -357,7 +345,7 @@ export class PipelinesController {
|
|||||||
|
|
||||||
@ApiInternalOnlyEndpoint()
|
@ApiInternalOnlyEndpoint()
|
||||||
@Post('/complete-upload')
|
@Post('/complete-upload')
|
||||||
@RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE)
|
@RequireAllPermissions(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW)
|
||||||
async completeUploadFile(
|
async completeUploadFile(
|
||||||
@User() user: RequestUser,
|
@User() user: RequestUser,
|
||||||
@Body() body: ICompleteUploadCSVFile,
|
@Body() body: ICompleteUploadCSVFile,
|
||||||
@@ -375,7 +363,7 @@ export class PipelinesController {
|
|||||||
|
|
||||||
@ApiInternalOnlyEndpoint()
|
@ApiInternalOnlyEndpoint()
|
||||||
@Post('/file')
|
@Post('/file')
|
||||||
@RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE)
|
@RequireAllPermissions(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW)
|
||||||
async uploadedFile(
|
async uploadedFile(
|
||||||
@User() user: RequestUser,
|
@User() user: RequestUser,
|
||||||
@Body() body: ICreatePipelineCSVFile,
|
@Body() body: ICreatePipelineCSVFile,
|
||||||
@@ -425,6 +413,7 @@ export class PipelinesController {
|
|||||||
|
|
||||||
@ApiInternalOnlyEndpoint()
|
@ApiInternalOnlyEndpoint()
|
||||||
@Post('start/:id')
|
@Post('start/:id')
|
||||||
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE)
|
||||||
async activate(@Param('id') id: string, @Body() body) {
|
async activate(@Param('id') id: string, @Body() body) {
|
||||||
const { info } = body;
|
const { info } = body;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user