There are lots of snippets / workaround published on limiting user’s access to WordPress Media library, but I found this helpful StackOverflow thread, specifically Paul’s answer, to be the most useful for the time being.
I still need some adjustments tho. In my circumstances:
- Apply the
fix_post_countsfiltering to the post type needed
- Check user’s role first. Editor above wouldn’t need this kind of limitation
- Some error handling for user with no media at all.