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

Enable policy opts in query and transact #46

Merged
merged 5 commits into from
Apr 6, 2023
Merged

Conversation

mpoffald
Copy link
Contributor

@mpoffald mpoffald commented Apr 6, 2023

Closes #38

Depends on fluree/db#445

Adds handling of policy-relevant opts ("did" and "role" for now), so that they can be passed in to queries and transactions.

@mpoffald mpoffald requested a review from a team April 6, 2023 16:33
Copy link
Contributor

@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.

Does this work in EDN too?

@@ -4,3 +4,4 @@
/target/*
.clj-kondo/babashka
.clj-kondo/metosin
.dir-locals.el
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the tiniest of nitpicks but these editor-specific ignores might be better in your global gitignore (e.g. ~/.gitignore which I think you have to then tell git to use in its config). However, I know Emacs is a pretty popular choice around here and for Clojure in general 😉 so I'm fine with it either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have this in our gitignores on db and json-ld, so I actually originally assumed its absence here was an oversight.

Emacs is pretty popular among lispers, so it's convenient to have it, but I won't die on this hill either 😄

{:ledger ledger-name
:query (assoc secret-query
:opts {"role" "ex:userRole"
"did" alice-did})})
Copy link
Contributor

Choose a reason for hiding this comment

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

Unindent one space?

(-> query-res :body json/read-value))
"query policy opts should prevent seeing bob's secret")
(let [txn-req {:body
(json/write-value-as-string
Copy link
Contributor

Choose a reason for hiding this comment

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

Unindent three spaces?

@mpoffald
Copy link
Contributor Author

mpoffald commented Apr 6, 2023

@cap10morgan thanks for reminding me about edn, I added support and some tests.

And I had actually neglected to clean up my whitespace generally, so I just ran some formatting on all my new tests and pushed it up. It ended up changing more than what you had suggested, but it should now be consistent at least.

Copy link
Contributor

@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.

LGTM!

@mpoffald mpoffald merged commit 97d4d7a into main Apr 6, 2023
@mpoffald mpoffald deleted the feature/policy-opts branch April 6, 2023 21:24
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.

Enable use of policy-invoking opts in transactions and queries
2 participants