FIX: Data asset sharing

This commit is contained in:
Victor Radael
2022-09-30 18:22:29 -03:00
parent 1ff135c0d7
commit a371db355b
3 changed files with 45 additions and 3 deletions
@@ -179,6 +179,7 @@ export class CatalogController {
id,
body,
metadata,
customer_id,
);
return res;
@@ -209,6 +210,7 @@ export class CatalogController {
body,
query,
metadata,
customer_id,
);
return res;
}
+42 -2
View File
@@ -209,7 +209,7 @@ class CatalogService implements OnModuleInit {
return { data_assets: response };
}
async getOneDashboardMetabase(id, body, metadata) {
async getOneDashboardMetabase(id, body, metadata, customer_id) {
const nimbusUrl = this._getNimbusUrl(body);
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/dashboard-metabase/${id}`,
@@ -229,10 +229,30 @@ class CatalogService implements OnModuleInit {
const owner = result !== null ? result.user.username : null;
const [customer_users, customer_roles] =
await this.getUsernamesAndRolesByCustomerId(customer_id);
const users = [];
const roles = [];
for (const role of customer_roles) {
for (const role_id of opensearchTable.roles) {
if (role.id === role_id) roles.push(role);
}
}
for (const user of customer_users) {
for (const user_id of opensearchTable.users) {
if (user.id === user_id) users.push(user);
}
}
return {
...data,
tags: opensearchTable.tags,
description: opensearchTable.description || null,
roles,
users,
owner,
};
}
@@ -245,7 +265,7 @@ class CatalogService implements OnModuleInit {
return data;
}
async getOneTableMetadata(body, params, metadata) {
async getOneTableMetadata(body, params, metadata, customer_id) {
const nimbusUrl = this._getNimbusUrl(body);
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/table-metadata/`,
@@ -265,11 +285,31 @@ class CatalogService implements OnModuleInit {
const owner = result !== null ? result.user.username : null;
const [customer_users, customer_roles] =
await this.getUsernamesAndRolesByCustomerId(customer_id);
const users = [];
const roles = [];
for (const role of customer_roles) {
for (const role_id of opensearchTable.roles) {
if (role.id === role_id) roles.push(role);
}
}
for (const user of customer_users) {
for (const user_id of opensearchTable.users) {
if (user.id === user_id) users.push(user);
}
}
return [
{
...data[0],
tags: opensearchTable.tags,
table_description: opensearchTable.description,
users,
roles,
owner,
},
];
+1 -1
View File
File diff suppressed because one or more lines are too long