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

Enforce policies for transactions #367

Merged
merged 7 commits into from
Feb 6, 2023
Merged

Enforce policies for transactions #367

merged 7 commits into from
Feb 6, 2023

Conversation

bplatz
Copy link
Contributor

@bplatz bplatz commented Feb 5, 2023

This closes issue #296. This relies on PR #365 (still waiting approval).

Policy enforcement had been limited to queries. This extends it to now support transactions.

See new tests for a full example. A quick summary is that this policy on products (class :ex/Prouct):

{:id            :ex/ProductPolicy,
:type          [:f/Policy],
:f/targetClass :ex/Product
:f/property    [{:f/path   :schema/name
                 :f/allow  [{:f/targetRole :ex/userRole
                 :f/action [:f/view :f/modify]}]}]}

Would allow a user that is part of:ex/userRole to view and modify :schema/name only - they could neither view nor modify anything else.

Therefore, this transaction would succeed:

{:id          :ex/widget
 :schema/name "Some Product Name"}

And this transaction would fail:

{:id           :ex/widget
 :schema/price 42.99}

@bplatz bplatz requested a review from a team February 5, 2023 20:43
Copy link
Contributor

@dpetran dpetran left a comment

Choose a reason for hiding this comment

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

👍

Base automatically changed from fix/ssc-perm to main February 6, 2023 16:56
@bplatz bplatz merged commit f877077 into main Feb 6, 2023
@bplatz bplatz deleted the feature/policy-tx branch February 6, 2023 16:57
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.

2 participants