Enhancement 418 : Provide extension points and extension helper api
Priority 
Medium
Reported Version 
 
Logged By 
bthule
Status 
Fixed
Fixed Version 
github
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
21/08/2012
Updated 
21/08/2012
Type 
Enhancement
 
Attachments 
No attachments

I would like to build a custom security solution that would alter the where clause and add in restrictions. So I might annotate an entity with @Security("user=:current_user") which would only return rows belonging to the current_user. If ebean provided an extension point that allowed altering the query before it was ran, then I could read my annotations, and and modify the query and add a "current_user" parameter value.

The extensions could be helpful for other things, such as custom logging, or doing some advanced, db specific sql without having to go fully to RawSql. Extension points could also allow doing different queries based on a parameter which could be useful for optimizing queries or allowing mock data, or creating a unified interface for selecting current or archived data.

Possibly @Formula would be a good fit to be coded using extensions.

An extension helper api would be needed, that would provide methods for helping add proper sql code, inserting sql at correct spots, finding existing sql, deleting existing sql, setting fetching details, and so on.

 
woResponse

Upload a file