Add overall filter to a model

Hi!
We have a situation where we need to remove certain records from all views in Forest admin.

The idea is to never show unverified users from our DB, and the verification status is backed by a timestamp being set, something like, account_verified_at: oneOf(null, Timestamp).

What I think I need to do is to override the index route in routes/users.js but I’m unsure of how to do it without breaking the segment building inside Forest admin.

I’ve see that the segments get sent as request.query.filters but how could I add a rule on top of those to makes sure that no records with account_verified_at: null are passed through?

The route I’m using is:

router.get('/users', permissionMiddlewareCreator.list(), (request, response, next) => {
  ...
}

Any help is appreciated!
Best,
David

Hi @svensson-david,

If you want those users to be removed from the entire application, you just need to use the scope feature :wink: https://docs.forestadmin.com/documentation/reference-guide/scopes

Ah I see, will have a look at that!
Thanks