A meta query to be used with the Members plugin by Justin Tadlock. This meta query and will not have any effect without the plugin installed and active.
This Meta Query has two arguments and accepts either one. They are both based on post meta assigned using the Members plugin Content Permissions meta box on the post edit screen.
This meta query argument will exclude any posts from your custom WP_Query
with roles assigned in the Content Permissions meta box that do not match the current user's role.
Since the first argument also hid posts that did not have any role assigned in the Content Permissions meta box, I added this second post to be inclusive of those posts by default.
You could easily use this code with a different membership or content restriction plugin by substituting the _members_access_role
key with the post meta key your plugin uses.