Skip to content
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

Merged
merged 9 commits into from
Nov 20, 2023
Merged

Conversation

mpoffald
Copy link
Contributor

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 to subid 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.

Copy link
Member

@cap10morgan cap10morgan left a 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! :)

src/fluree/db/json_ld/policy.cljc Outdated Show resolved Hide resolved
src/fluree/db/json_ld/policy.cljc Outdated Show resolved Hide resolved
@(fluree/query-connection conn
{:context context
:from "policy/a"
:select '[?name ?ssn]
Copy link
Member

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

test/fluree/db/policy/basic_test.clj Outdated Show resolved Hide resolved
Copy link
Contributor

@zonotope zonotope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📑

src/fluree/db/json_ld/policy.cljc Outdated Show resolved Hide resolved
@mpoffald mpoffald merged commit c12f5c0 into main Nov 20, 2023
7 checks passed
@mpoffald mpoffald deleted the fix/expand-policy-opts branch November 20, 2023 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants