This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch custos-integration
in repository https://gitbox.apache.org/repos/asf/airavata-data-catalog.git
The following commit(s) were added to refs/heads/custos-integration by this
push:
new e5cd6e4 Initial implementation of data product sharing view
e5cd6e4 is described below
commit e5cd6e43c89b4e449f205b5b9736344947bbd2a6
Author: Marcus Christie <[email protected]>
AuthorDate: Fri Mar 31 15:12:29 2023 -0400
Initial implementation of data product sharing view
For #12
---
.../resources/custos_data_product_sharing_view.sql | 24 ++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git
a/data-catalog-api/server/src/main/resources/custos_data_product_sharing_view.sql
b/data-catalog-api/server/src/main/resources/custos_data_product_sharing_view.sql
new file mode 100644
index 0000000..527ce3c
--- /dev/null
+++
b/data-catalog-api/server/src/main/resources/custos_data_product_sharing_view.sql
@@ -0,0 +1,24 @@
+-- TODO: get this into a database migration script
+CREATE
+OR REPLACE VIEW custos_data_product_sharing_view AS
+SELECT
+ dp.data_product_id AS data_product_id,
+ s.associating_id AS user_id,
+ CASE
+ WHEN s.permission_type_id = concat('OWNER', s.tenant_id) THEN 0
+ WHEN s.permission_type_id = concat('READ', s.tenant_id) THEN 1
+ WHEN s.permission_type_id = concat('READ_METADATA', s.tenant_id) THEN 2
+ WHEN s.permission_type_id = concat('WRITE', s.tenant_id) THEN 3
+ WHEN s.permission_type_id = concat('WRITE_METADATA', s.tenant_id) THEN
4
+ WHEN s.permission_type_id = concat('MANAGE_SHARING', s.tenant_id) THEN
5
+ ELSE NULL
+ END AS permission_id
+FROM
+ sharing s
+ INNER JOIN tenant t ON t.external_id = s.tenant_id
+ INNER JOIN user_table u ON u.external_id = s.associating_id
+ AND u.tenant_id = t.tenant_id
+ INNER JOIN data_product dp ON concat(dp.external_id, t.external_id) =
s.entity_id
+WHERE
+ -- TODO: add group support
+ s.associating_id_type = 'user';