Thank you very much for the effort and the feedback.
- Regarding the “policies”: I had already tried all of these, as well as numerous variants, but unfortunately without success.
To make this transparent to you, I have now chosen a way to make the problem reducible:
a) I have taken the naked project template “202306.4.0”. Here there is only one DataModel (‘Person-document’) with one test person (“Johny”).
Here I have only added some more test persons and enabeld the debugging by the line
logging.level.com.mgmtp.a12.uaa.authorization.security.spel=DEBUG
b) Then I varied the existing childAuthorization-json (see below) and saw what the result was . As a test position, I have set myself the goal of only allowing documents to be readable if the first name (“Person.PersonalData.FirstName”) is “Johny”
b.1) if I understood your suggestion correctly , the first policy could replaced by
{
"name": "Document Read By User Created",
"description": "test",
"target": "hasAccessRight('DOCUMENT_READ')",
"rules": [
"#resource.kernelDocument.Person.PersonalData.FirstName == 'Johny'"
]
},
…and it should work. However, here is the output:
2024-01-24 13:57:33,712 [27.0.0.1-8082-exec-9][DEBUG][.security.spel.internal.SpelRuleExecutor][u:admin] - ...Expression #resource.kernelDocument.Person.PersonalData.FirstName == 'Johny' execution failed context[1398330454]. EL1008E: Property or field 'Person' cannot be found on object of type 'com.mgmtp.a12.kernel.md.document.internal.service.impl.DocumentImpl' - maybe not public or not valid?
Can you reproduce this?
I find the error message at least understandable, because the properties do not exist in DocumentImpl.
d) with my variant it works; however, I find the method confusing as I mentioned yesterday and the question is whether there is an easier way.
{
"name": "Document Read By User Created",
"description": "test",
"target": "hasAccessRight('DOCUMENT_READ')",
"rules": [
"#resource.kernelDocument.getEntityInstancesAtOrBelowPath('/Person/PersonalData/FirstName').get(0).getValue().get() == 'Johny'"
]
},
- to the “repositoryPolicies”: Here it works with the filtering by the template
"'Person.PersonalData.FirstName:Johny'"
Thank you very much!
So the problem with my document model lies somewhere on my side.
Is there by any chance a way to ask Solr directly queries so that I can debug what is indexed? I know a Solr web interface from other none-A12-projects…
Many thanks and best regards, Joachim Weinhart