My goal is to show the list of attachments by user role in the Media Library. So if I limit a user in the posts edit dialog to a page ID (and its children) shouldn’t the media library only show those images attached to pages or posts for which this user has access?
Right now only the parent page’s image attachment is shown , not the images attached to the children.
Do I need to go to “force cpts to use custom caps” to get this to work? Right now I am being permissive and just limiting via admin menus dialog.
Right, Media Library should show to restricted user attachments for all pages which he can edit. While child pages are included into the list of editable items automatically with the parent page, related attachments are not included for some reason. I will investigate the issue and try to find a solution.
If image was uploaded to Media Library and inserted into the post, its attachment record has that post ID as a post_parent.
But if user just select existing image from Media Library to insert to the post B, its parent post A stays the same, older one. URE can not select/count such image as attachment to the post B, which is allowed for editing by current user. URE looks at this Media Library item as attachment to the post A.
Please open one of the child pages allowed for editing, click “Isert media”, upload new image and insert it into the page. Then open “Media Library” under restricted user. He should see, such image. But he will not see images uploaded by others for posts/pages, which he can not edit.