From c6aa1de974dc60868470192fa9862536dc4588db Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Thu, 29 Feb 2024 12:41:39 +0100 Subject: [PATCH] Support user profile matching by External Auth ID --- .../firsttime/profile_proximity_query.n3 | 81 ++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) 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..dc379e46b 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 { @@ -70,8 +76,81 @@ access-individual:PersonProfileProximityToResourceUri a access:SparqlSelectValue } 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) + } + } + """ .