mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-13 18:09:09 +00:00
FEAT: create RLS on pi-factory
This commit is contained in:
@@ -633,4 +633,20 @@ export class CatalogController {
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Post('rls-rule')
|
||||
@ApiOkResponse({ type: GetDatasetCatalogTaskRes })
|
||||
async addRlsRule(@User() user: RequestUser, @Body() body) {
|
||||
const { customer_id, customer_name, user_id, username } = user;
|
||||
const metadata = PackTheMetadata({
|
||||
customer_id,
|
||||
customer_name,
|
||||
user_id,
|
||||
username,
|
||||
});
|
||||
console.log(body);
|
||||
const response = await this.catalogService.addRlsRule(body, metadata);
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import { UsersService } from '../users/users.service';
|
||||
import { RolesService } from '../roles/roles.service';
|
||||
import { Metadata } from '@grpc/grpc-js';
|
||||
import { IUpdateDataRequest, TriggerCatalogReq } from './dtos';
|
||||
import { AddRlsUserToDashboardRequest } from '@dadosfera/protospack-v2/dist/lib/Catalog/interfaces/messages';
|
||||
|
||||
class CatalogService implements OnModuleInit {
|
||||
catalogReadService: ReadService.CatalogReadServices;
|
||||
@@ -345,6 +346,16 @@ class CatalogService implements OnModuleInit {
|
||||
);
|
||||
return res;
|
||||
}
|
||||
async addRlsRule(data: AddRlsUserToDashboardRequest, metadata: Metadata) {
|
||||
const newData: AddRlsUserToDashboardRequest = {
|
||||
...data,
|
||||
rls_option: `rls_email`,
|
||||
};
|
||||
const res = await lastValueFrom(
|
||||
this.catalogWriteService.AddRlsUserToDashboard(newData, metadata),
|
||||
);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
export { CatalogService };
|
||||
|
||||
Reference in New Issue
Block a user