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

Authorizer for DeleteBuilder #505

Closed
andrus opened this issue Dec 5, 2021 · 0 comments
Closed

Authorizer for DeleteBuilder #505

andrus opened this issue Dec 5, 2021 · 0 comments
Milestone

Comments

@andrus
Copy link
Contributor

andrus commented Dec 5, 2021

Similar to #501 and #502, DeleteBuilder should also support DeleteAuthorizer It will require adding a couple more stages to the delete pipeline (MAP_CHANGES, AUTHORIZE_CHANGES).

Challenge: currently we allow bulk delete of all rows without bringing objects in memory. We will need to integrate it with DeleteAuthorizer somehow.

Usage example

This is per-request API. Same can be applied per Agrest stack using similar AgEntityOverlay methods.

Ag.service(config)
    .delete(E2.class)
    .id(id)
    .authorizer(o -> /* */)
    .delete();

Upgrade notes

Previously Agrest allowed for a special case of a "full table delete" to be processed in the database (via delete from table), without bringing the objects to the app memory. From now on "full table delete" is processed the same way as other delete cases - by selecting and analyzing the objects first. If your code uses "full table delete" on very large tables, this operation may become noticeably slower and may even fail due to insufficient memory. If you need such deletes (and willing to ignore the authorizers), you may bypass Agrest, and do a delete via Cayenne directly (or use the new stage API per #506)

@andrus andrus added this to the 4.8 milestone Dec 5, 2021
andrus added a commit that referenced this issue Dec 5, 2021
andrus added a commit that referenced this issue Dec 5, 2021
andrus added a commit that referenced this issue Dec 5, 2021
@andrus andrus closed this as completed Dec 5, 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