Replies: 2 comments 2 replies
-
Yes, but put them in your subclass of User object.
You can have User return a list of something fetched from the DB.
…On Sat, Jul 3, 2021 at 11:28 AM Thai Ngo ***@***.***> wrote:
Lets take a look at the value variable in the sample code below:
override fun getFilterExpression(entityClass: Type<*>, requestScope: RequestScope): FilterPredicate {
val userPath = Path.PathElement(getClassType(User::class.java), STRING_TYPE, "id")
val path = Path(listOf(userPath))
**val value = listOf(requestScope.user.name)**
return FilterPredicate(path, Operator.IN, value)
}
Is it possible and advisable to fetch some value list from datastore or
database and assign them to the value variable?
It seems that only some predefined values (boolean, enum, hardcoded
string) or/and extracted values from RequestScope can be used as
List<Object> that is needed to build FilterPredicate.
Appreciate your advice.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2188>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVH6QNHLFWTXTJDVIMBQVTTV43BDANCNFSM47YJBSEQ>
.
|
Beta Was this translation helpful? Give feedback.
-
To be clear, when I say 'User', I mean an Elide User object or principal which is different than a JPA bean or Elide model. It is like a Spring Authentication object. The filter expression check here is related to security - and the idea is that the User/Principal should contain (preloaded or lazily loaded) all the information about the user that any check might need or want to evaluate security rules. To populate our User/Principal, we just use straight JPA to fetch relevant info from the database. This is typically done at the time of authentication (although it could be done later). |
Beta Was this translation helpful? Give feedback.
-
Lets take a look at the
value
variable in the sample code below:Is it possible and advisable to fetch some value list from datastore or database and assign them to the
value
variable?It seems that only some predefined values (boolean, enum, hardcoded string) or/and extracted values from
RequestScope
can be used asList<Object>
that is needed to buildFilterPredicate
.Appreciate your advice.
Beta Was this translation helpful? Give feedback.
All reactions