Separate conditions for templates

Good people, help.
I had to do the following, so that the post type “product” created by the author and having the custom status “approved” could be seen only by the author of this post and the administrator. For everyone else, a 404 page should be given.

I’m struggling with the code, it doesn’t work :hot_face: