#7190
Vladimir
Keymaster

You don’t need a code for this. Open ‘Users->User Role Editor’, select role, click ‘Posts Edit’ insert the list of posts ID into the ‘with post ID (comma separated)’ field.
Or, you can make it individually for selected users via user profile.