I am creating a REST API using the spring framework, and have come across a not-so-interesting case that did not seem to find a solution for.
So, let's say that we have a table Table1 with columns Col1, Col2 and Col3 and we have users of access level 1,2 and 3
Access level 3 users are the only ones allowed access to Col3 along with all other columns, the rest are allowed access to anything else.
Also, I want the API to be able to return a subset of the fields based on the call, IE: if the call was called in URL / table / list? fl = col1, only Col1 will be returned.
What I need is a way to return this particular subset of data at the API level, apparently the spring JPA data does not allow the substring to return a dynamic table.
I was wondering what could be the cleanest way to do this without completely abandoning the JPA or rewriting all the functions in all entities.
source
share