Repository navigation
Closed
Description
Description
When the "f": "https://ns.flur.ee/ledger#" term is not defined by a user in their own context or defaultContext, an error gets thrown when using opts: { did, role }: clojure.lang.ExceptionInfo: Invalid compact-iri: :f/Policy {:status 400, :error :json-ld/invalid-iri}
However, the http-api-gateway instance still returns a 200 with a [] response body.
The issue can be recreated via the following (which mimics the test example here):
- Create Ledger (/create)
{
"ledger": "policy-opts-ledger",
"defaultContext": ["", {
"id": "@id",
"type": "@type",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"sh": "http://www.w3.org/ns/shacl#",
"schema": "http://schema.org/",
"skos": "http://www.w3.org/2008/05/skos#",
"wiki": "https://www.wikidata.org/wiki/",
"ex": "http://example.org/"
}],
"txn": {
"id": "ex:create-test",
"type": "ex:test",
"ex:name": "create-endpoint-test"
}
}- Add Data (/transact)
{
"ledger": "policy-opts-ledger",
"txn": [
{
"id": "ex:alice",
"type": "ex:User",
"ex:secret": "alice's secret"
},
{
"id": "ex:bob",
"type": "ex:User",
"ex:secret": "bob's secret"
},
{
"id": "ex:UserPolicy",
"type": [
"f:Policy"
],
"f:targetClass": {
"id": "ex:User"
},
"f:allow": [
{
"id": "ex:globalViewAllow",
"f:targetRole": {
"id": "ex:userRole"
},
"f:action": [
{
"id": "f:view"
}
]
}
],
"f:property": [
{
"f:path": {
"id": "ex:secret"
},
"f:allow": [
{
"id": "ex:secretsRule",
"f:targetRole": {
"id": "ex:userRole"
},
"f:action": [
{
"id": "f:view"
},
{
"id": "f:modify"
}
],
"f:equals": {
"@list": [
{
"id": "f:$identity"
},
{
"id": "ex:user"
}
]
}
}
]
}
]
},
{
"id": "did:fluree:Tf6i5oh2ssYNRpxxUM2zea1Yo7x4uRqyTeU",
"ex:user": {
"id": "ex:alice"
},
"f:role": {
"id": "ex:userRole"
}
}
]
}- Query as Alice (/query)
{
"ledger": "policy-opts-ledger",
"query": {
"where": [
["?s", "rdf:type", "ex:User"]
],
"select": {
"?s": ["*"]
},
"opts": {
"role": "ex:userRole",
"did": "did:fluree:Tf6i5oh2ssYNRpxxUM2zea1Yo7x4uRqyTeU"
}
}
}Metadata
Metadata
Assignees
Labels
bugSomething isn't working as expected
Activity
cap10morgan commentedon May 9, 2023
Transferred this issue to db repo as I think most or all of the work needs to happen in there.
cap10morgan commentedon May 10, 2023
@aaj3f I fixed what was likely the entire issue here in db, but can you test in http-api-gateway again to confirm? I've updated it to point at the latest db main HEAD commit.
I should probably add a test like this to the http-api-gateway repo too, but I need to rethink our testing strategy a bit before we end up with a copy of every test in both repos.