When using content moderation, the view_unpblished module does not work. But I really needed to get a user role to see all nodes created of this type and have access to it. With the following snippet, I fixed this.
I encountered a problem while working on a big migration. The client wanted to reuse files and images, so I added entity browser functionality. The problem however was that views does not provide a preview image for files. Therefore I created a small module.