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

feat: add previousValue to privacy policy context for updates #232

Merged
merged 1 commit into from
May 31, 2024

Conversation

wschurman
Copy link
Member

Why

One authorization evaluation case wasn't considered when building this context: when we want to allow a user to make a final update to an entity based on their permission from the value of the entity before the update, and then not allow them to make any further updates.

This PR adds previousValue to context for updates, somewhat like what we do for validators and triggers.

Closes ENG-12402.

Test Plan

Run tests (there's a test that looks for this value).

Copy link

linear bot commented May 31, 2024

@wschurman wschurman requested review from ide and kitten May 31, 2024 00:25
Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (60fc9a4) to head (b3ffa70).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #232   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           69        69           
  Lines         1892      1892           
  Branches       265       265           
=========================================
  Hits          1892      1892           
Flag Coverage Δ
integration 100.00% <100.00%> (ø)
unittest 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/entity/src/EntityPrivacyPolicy.ts Outdated Show resolved Hide resolved
Copy link
Member

@kitten kitten left a comment

Choose a reason for hiding this comment

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

Can't say I know the codebase well enough to give a proper review ❤️ But the change looks great, and having this capability is awesome! Code overall makes sense to me

Base automatically changed from @wschurman/can-delete to main May 31, 2024 19:41
@wschurman wschurman force-pushed the @wschurman/can-delete-more-2 branch from 02c338e to 660f2fa Compare May 31, 2024 19:46
@wschurman wschurman force-pushed the @wschurman/can-delete-more-2 branch from 660f2fa to b3ffa70 Compare May 31, 2024 20:07
@wschurman wschurman merged commit af495a9 into main May 31, 2024
3 checks passed
@wschurman wschurman deleted the @wschurman/can-delete-more-2 branch May 31, 2024 20:14
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.

3 participants