FilterExpressionCheck: How to filter all or none? #2043
Brutus5000
started this conversation in
Elide 5
Replies: 1 comment 4 replies
-
I would break this up into two checks:
The read permission rule would then be: "Principal Is Global Admin OR Principal Is Tenant" If the user check passes (principal is admin), the filter expression will not be applied. The filter expression check can be implemented to extract the list of tenantIds from the the user principal and then return a different expression depending on whether there are any tenants. If there are no tenants, return a |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Imagine the following use case:
I have a
Datasource
entity which has a relationshiprestrictions
to entities of typeRestriction
.Restriction
contains atenantId
.My user object has
globalAdmin
tenantIds
he has access to(I'm fetching the user via my Spring Security Context - this is not a User Check as it will be compared to the rows)
Now I build a FilterExpressionCheck with this logic:
all entities
user.tenantIds.isNotEmpty()
then useFilterPredicate(somePath, Operator.IN, user.tenantIds)
nothing
I am looking for a pre-defined FilterExpression for
return all items
andreturn nothing
. Is there such a thing?For now I'm using an ugly workaround by creating a FilterPredicate on the
Datasource.id
being null or not null, but that looks smelly and ugly and needs to be recreated for every entity I want to filter this way.Beta Was this translation helpful? Give feedback.
All reactions