Add common operators for permissions

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9628
GitOrigin-RevId: 2427e079353a7617fe5cdcdd9daeea5fecd4c04a
This commit is contained in:
Luca Restagno 2023-06-23 18:52:17 +02:00 committed by hasura-bot
parent 653106087c
commit c0ed68886a

View File

@ -93,6 +93,17 @@ export function comparatorsFromSchema(schema: GraphQLSchema): Comparators {
}, {});
}
const commonOperators = [
'_eq',
'_ne',
'_gt',
'_lt',
'_gte',
'_lte',
'_in',
'_nin',
];
const whitelist: Record<string, string[]> = {
jsonb: [
'_is_null',
@ -105,8 +116,9 @@ const whitelist: Record<string, string[]> = {
// JSON does not seem to come with any operators
// To match the old implementation, which does not provide any operators, we do not whitelist any for now
json: [],
geography: ['_st_d_within', '_is_null', '_st_intersects'],
geography: [...commonOperators, '_st_d_within', '_is_null', '_st_intersects'],
geometry: [
...commonOperators,
'_is_null',
'_st_d_within',
'_st_within',