Show unpublished entries only to a specific user role. No publicationState=preview for public

Strapi v4:
I want to show no preview entries for APIs only to a specific user role and not public => ?publicationStatus=preview should only work for users in a specific role.
On discord I got the hint to use middlewares, but I have no idea how to start. I have to wipe out all entries with publishedAt=null for all users not in the specific group.
How to get the user and the role?
How to manipulate the entries?

1 Like