From 7bb3bd643838cd07a095db9e2320c609ab080166 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Wed, 17 Apr 2024 22:37:45 +0200 Subject: [PATCH] Support self editor profile matching by using External Auth ID (#3947) * Support user profile matching by External Auth ID * fixed property uri --- .../firsttime/profile_proximity_query.n3 | 85 ++++++++++++++++++- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/home/src/main/resources/rdf/accessControl/firsttime/profile_proximity_query.n3 b/home/src/main/resources/rdf/accessControl/firsttime/profile_proximity_query.n3 index 928713e82..5de1070de 100644 --- a/home/src/main/resources/rdf/accessControl/firsttime/profile_proximity_query.n3 +++ b/home/src/main/resources/rdf/accessControl/firsttime/profile_proximity_query.n3 @@ -3,6 +3,12 @@ @prefix access-individual: . @prefix access: . +# Reserved variable names: +# profileUri - user account associated profile +# objectUri - access object uri +# externalAuthId - user account external auth id (should match with profile external auth id) +# matchingPropertyUri - uri of property used for auth id matching, selfEditing.idMatchingProperty defined in runtime.properties + access-individual:PersonProfileProximityToResourceUri a access:SparqlSelectValuesQuery ; access:id """ SELECT ?resourceUri WHERE { @@ -58,20 +64,93 @@ access-individual:PersonProfileProximityToResourceUri a access:SparqlSelectValue { ?profileUri ?roleUri . ?roleUri a . - ?roleUri ?resourceUri . + ?roleUri ?resourceUri . ?resourceUri a . } UNION { ?profileUri ?roleUri . ?roleUri a . - ?roleUri ?resourceUri . + ?roleUri ?resourceUri . ?resourceUri a . } UNION { - BIND ( ?profileUri as ?resourceUri) + BIND (?profileUri as ?resourceUri) } } """ . +access-individual:ExternalIdMatchProfileProximityToResourceUri a access:SparqlSelectValuesQuery ; + access:id """ + SELECT ?resourceUri WHERE { + ?profile ?matchingPropertyUri ?externalAuthId . + { + ?profile ?roleUri . + ?roleUri a . + ?roleUri ?resourceUri . + ?resourceUri a . + } + UNION + { + ?profile ?roleUri . + ?roleUri a . + ?roleUri ?resourceUri . + ?resourceUri a . + } + UNION + { + ?profile ?roleUri . + ?roleUri a . + ?roleUri ?resourceUri . + ?resourceUri a . + } + UNION + { + ?profile ?roleUri . + ?roleUri a . + ?roleUri ?resourceUri . + ?resourceUri a . + } + UNION + { + ?profile ?roleUri . + ?roleUri a . + ?roleUri ?resourceUri . + ?resourceUri a . + } + UNION + { + ?profile ?roleUri . + ?roleUri a . + ?roleUri ?resourceUri . + ?resourceUri a . + } + UNION + { + ?profile ?roleUri . + ?roleUri a . + ?roleUri ?resourceUri . + ?resourceUri a . + } + UNION + { + ?profile ?roleUri . + ?roleUri a . + ?roleUri ?resourceUri . + ?resourceUri a . + } + UNION + { + ?profile ?roleUri . + ?roleUri a . + ?roleUri ?resourceUri . + ?resourceUri a . + } + UNION + { + ?profile ?matchingPropertyUri ?externalAuthId . + BIND (?profile as ?resourceUri) + } + } + """ .