Extend all endpoint with permission logic

System Information
  • Strapi Version: 4
  • Operating System: Linux
  • Database: filestorage
  • Node Version: latest
  • NPM Version: latest
  • Yarn Version: latest

Each collection has a field “Owner” and each entry has one or more user permission relations in it.

Currently I am extending each controller and making the standard endpoints find, findOne, create, delete and update do something with this field. With find/findOne it only return items where the user is entered as owner and with update/delete it may only be written if it is owner and with create it is entered as owner.

But this is the case with every collection, so the question would be: where and how to do this centrally, so that you do not have the code multiple times?