-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand policy opts role using supplied context #693
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Since we'd been discussing it last week, I posted some style / code readability nitpick-y stuff (read: cranky opinions). Feel free to ignore! :)
test/fluree/db/policy/basic_test.clj
Outdated
@(fluree/query-connection conn | ||
{:context context | ||
:from "policy/a" | ||
:select '[?name ?ssn] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"policy/a"
is misaligned w/r/t the other map vals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📑
Part of fluree/core#61
Up to now, the
wrap-policy
process has relied entirely on default context to expand the iri of the provided:role
and look up its subject id. The call it has been making tosubid
has a default behavior that expands using the db's default context.This PR updates our policy opts helper (renamed to
policy-identity
) to expand the iri itself when given a context. Also updates our api fns to pass the supplied context from the request to that helper fn.I removed the use of default context from a large number of the policy tests, but not all of them.
I did not want to mess with removing any existing default context logic yet (and have to change many unrelated tests), so there's some redundancy here. I have introduced a context helper that just pulls out the supplied context from the request map, with no interaction with the default context whatsoever. I just use this when processing opts, leaving existing context retrieval/calculation processes (which do use default context) intact.