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

Replace EntityEncoderFilter with per-entity object filter #501

Closed
andrus opened this issue Nov 25, 2021 · 0 comments
Closed

Replace EntityEncoderFilter with per-entity object filter #501

andrus opened this issue Nov 25, 2021 · 0 comments
Milestone

Comments

@andrus
Copy link
Contributor

andrus commented Nov 25, 2021

As mentioned in #445 , EntityEncoderFilter is not that easy to use:

  • Mixes encoding and access control logic
  • Requires logic duplication between willEncode and encode
  • Is not strictly per-entity (though there are per-entity utilities to create filters)

Let's design a new ReadFilter API that will allow to filter objects in GET or POST/PUT requests before sending them to client based on custom logic. It should be per-entity, and internally attached to AgEntity/AgEntityOverlay, just like property filtering is. It should also address a recently deprecated use case of Constraint.qualifier.

Notes on the implementation:

  • EntityEncoderFilter is deprecated in 4.8 and will be removed in 5.0.
  • A new SelectStage.FILTER stage is added at the end of the select pipeline
  • Here is how the new ReadFilter API works:
// per-request
Ag.service(config)
    .select(E.class)
    .filter(E.class, e -> /* eval some condition */))
    .filter(A.class, a -> /* eval some condition */))
    .get();

// per-runtime
new AgBuilder()
    .entityOverlay(
        AgEntity.overlay(E.class).readFilter(e -> /* eval some condition */))
    )
   .entityOverlay(
        AgEntity.overlay(A.class).readFilter(a -> /* eval some condition */))
    )
    .build();
@andrus andrus changed the title Replace EntityEncoderFilter with per-entity read and write acce Replace EntityEncoderFilter with per-entity read / write filter Nov 25, 2021
@andrus andrus changed the title Replace EntityEncoderFilter with per-entity read / write filter Replace EntityEncoderFilter with per-entity object read filter Nov 25, 2021
andrus added a commit that referenced this issue Nov 26, 2021
.. renaming access rules to filters for symmetry with #501 and #502
@andrus andrus changed the title Replace EntityEncoderFilter with per-entity object read filter Replace EntityEncoderFilter with per-entity object filter Nov 27, 2021
andrus added a commit that referenced this issue Nov 28, 2021
andrus added a commit that referenced this issue Nov 28, 2021
andrus added a commit that referenced this issue Nov 28, 2021
.. object filter API in SelectBuilder and UpdateBuilder
andrus added a commit that referenced this issue Nov 28, 2021
.. keeping just readbale filter to stay within the scope of #501
andrus added a commit that referenced this issue Nov 28, 2021
.. attempt at implementing FilterDataStage
andrus added a commit that referenced this issue Nov 28, 2021
andrus added a commit that referenced this issue Nov 28, 2021
andrus added a commit that referenced this issue Nov 28, 2021
andrus added a commit that referenced this issue Nov 28, 2021
andrus added a commit that referenced this issue Nov 28, 2021
andrus added a commit that referenced this issue Nov 28, 2021
@andrus andrus added this to the 4.8 milestone Nov 28, 2021
@andrus andrus closed this as completed Nov 28, 2021
andrus added a commit that referenced this issue Dec 5, 2021
.. refactoring stage names to match update stages
andrus added a commit that referenced this issue Dec 26, 2021
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

No branches or pull requests

1 participant