-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update doc following core API migration and 2.0.0 release (#14)
- feat: describe missing endpoints used to set / remove rights on entities - feat: update contract for get authorized entities endpoint - feat: global update for new architecture in 2.0.0 - feat: add migration procedure to upgrade to 2.0.0 --------- Co-authored-by: Gaël Poujol <76944966+gpoujol@users.noreply.github.com> Co-authored-by: gpoujol <gael.poujol@egm.io>
- Loading branch information
1 parent
bdc2e43
commit c513a74
Showing
13 changed files
with
589 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
WITH "MATCH (n:`https://ontology.eglobalmark.com/authorization#Client`)-[:HAS_VALUE]->(pSid:Property {name: 'https://ontology.eglobalmark.com/authorization#serviceAccountId'}) | ||
MATCH (n)-[:HAS_VALUE]->(pClientId:Property {name: 'https://ontology.eglobalmark.com/authorization#clientId'}) | ||
RETURN substring(n.id, 19), substring(pSid.value, 17), pClientId.value" AS query | ||
CALL apoc.export.csv.query(query, "/subject_export/export_clients.csv", {}) | ||
YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data | ||
RETURN file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data; | ||
|
||
WITH "MATCH (n:`https://ontology.eglobalmark.com/authorization#User`)-[:HAS_VALUE]->(pUsername:Property {name: 'https://ontology.eglobalmark.com/authorization#username'}) | ||
OPTIONAL MATCH (n)-[:HAS_VALUE]->(pGivenName:Property {name: 'https://ontology.eglobalmark.com/authorization#givenName'}) | ||
OPTIONAL MATCH (n)-[:HAS_VALUE]->(pFamilyName:Property {name: 'https://ontology.eglobalmark.com/authorization#familyName'}) | ||
RETURN substring(n.id, 17), pUsername.value, pGivenName.value, pFamilyName.value" AS query | ||
CALL apoc.export.csv.query(query, "/subject_export/export_users.csv", {}) | ||
YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data | ||
RETURN file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data; | ||
|
||
WITH "MATCH (n:`https://ontology.eglobalmark.com/authorization#Group`)-[:HAS_VALUE]->(pName:Property {name: 'https://schema.org/name'}) | ||
RETURN substring(n.id, 18), pName.value" AS query | ||
CALL apoc.export.csv.query(query, "/subject_export/export_groups.csv", {}) | ||
YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data | ||
RETURN file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
-- Create temp table for groups and import data | ||
|
||
create table temp_info_groups (sub text, name text, subject_info jsonb); | ||
copy temp_info_groups(sub, name) from '/tmp/export_groups.csv' csv header; | ||
update temp_info_groups | ||
set subject_info = jsonb_build_object( | ||
'type', 'Property', | ||
'value', jsonb_build_object('kind', 'Group', 'name', name) | ||
); | ||
update subject_referential | ||
set subject_info = ( | ||
select subject_info | ||
from temp_info_groups | ||
where sub = subject_referential.subject_id | ||
) | ||
where subject_type = 'GROUP'; | ||
update subject_referential | ||
set subject_info = jsonb_build_object( | ||
'type', 'Property', | ||
'value', jsonb_build_object('kind', 'Group') | ||
) | ||
where subject_type = 'GROUP' | ||
and subject_info is null; | ||
|
||
-- Create temp table for users and import data | ||
|
||
create table temp_info_users (sub text, username text, given_name text, family_name text, subject_info jsonb); | ||
copy temp_info_users(sub, username, given_name, family_name) from '/tmp/export_users.csv' csv header; | ||
update temp_info_users | ||
set given_name = null | ||
where given_name = 'null'; | ||
update temp_info_users | ||
set family_name = null | ||
where family_name = 'null'; | ||
update temp_info_users | ||
set subject_info = jsonb_build_object( | ||
'type', 'Property', | ||
'value', jsonb_strip_nulls( | ||
jsonb_build_object('kind', 'User', 'username', username, 'givenName', given_name, 'familyName', family_name) | ||
) | ||
); | ||
update subject_referential | ||
set subject_info = ( | ||
select subject_info | ||
from temp_info_users | ||
where sub = subject_referential.subject_id | ||
) | ||
where subject_type = 'USER'; | ||
|
||
update subject_referential | ||
set subject_info = jsonb_build_object( | ||
'type', 'Property', | ||
'value', jsonb_build_object('kind', 'User') | ||
) | ||
where subject_type = 'USER' | ||
and subject_info is null; | ||
|
||
-- Create temp table for clients and import data | ||
|
||
create table temp_info_clients (sub text, sid text, client_id text, subject_info jsonb); | ||
copy temp_info_clients(sub, sid, client_id) from '/tmp/export_clients.csv' csv header; | ||
update temp_info_clients | ||
set subject_info = jsonb_build_object( | ||
'type', 'Property', | ||
'value', jsonb_build_object('kind', 'Client', 'clientId', client_id) | ||
); | ||
update subject_referential | ||
set subject_info = ( | ||
select subject_info | ||
from temp_info_clients | ||
where sub = subject_referential.subject_id | ||
) | ||
where subject_type = 'CLIENT'; | ||
|
||
update subject_referential | ||
set subject_info = jsonb_build_object( | ||
'type', 'Property', | ||
'value', jsonb_build_object('kind', 'Client') | ||
) | ||
where subject_type = 'CLIENT' | ||
and subject_info is null; | ||
|
||
-- Delete temp tables | ||
|
||
drop table temp_info_groups; | ||
drop table temp_info_users; | ||
drop table temp_info_clients; |
Oops, something went wrong.