Customizing Filter on a Collection Type List

System Information
  • Strapi Version: 3.4.1
  • Operating System: Win64x
  • Database: SQLLite
  • Node Version: 14.11.0
  • NPM Version: 6.14.8
  • Yarn Version: 1.22.5

Is it possible to change the result of a collectionlist before it is displayed in the admin UI, e.g. to filter out certain records before they are displayed ? Is there a lifecycle hook that could be used for this ?

2 Likes

Is there really no solution for that? In my case, I want to prevent users with the same role from seeing records from other users. How can I do that ?

I’m trying to do exactly the same.
Initially I override the user-permissions plugin, by creating the endpoint and a new handler for this endpoint. i.e
In my case I created a field Personal Trainer, for the user (a user can have a PT). then I created the route and the handler but for my surprise it is not called at all… for what I can see the UI / Strapi call an internal API, content-manager

POST /content-manager/relations/plugins::users-permissions.user/personal_trainer?_limit=20 (535 ms) 200

Is there any way to do this? I believe filtering on relationship it is a pretty much extended use case, i.e show food that is not expired… etc etc

2 Likes

Yes, Strapi UI calls the content-manager’s API to retrieve data.

The answer is Author Role. Authors can manage and publish only the content they created. You can also use custom admin roles to manage it.

To mention, you should not let the end-users access Admin UI. For end-users, you should build something custom.

1 Like

But would something like that be possible to achieve? I’m in the same case. I want to show only some items of a collection that meet some specific requirements.

1 Like

Folks, anyone has a solution for this ? I want to add custom filters in List view & apply those filters before rendering the values.

have you guys tried to override the query with the life cycles?