netmix / radio-station

Radio Station WordPress Plugin (Open Source)
https://netmix.com
GNU General Public License v3.0
19 stars 14 forks source link

[Show Related Posts] DJ's can edit assign posts to others' Shows #276

Closed matzuras closed 3 years ago

matzuras commented 3 years ago

In the current version (2.3.3.5) anyone can create posts in, or edit, anyone's show. Did I misconfigure RS somehow, or is this a known problem? Here's what I did to reproduce this:

  1. Sign in as someone with only the DJ role.
  2. Go to Posts > Add New > Related To, fill in some prelim text like title and comment, then chose a show from the drop-down list of all shows that was not mine.
  3. Clicked Publish.

My newly added post appeared in the other DJ's show on that show's own page.

It seems to me that only shows I own should appear in the drop-down list of shows.

tonyzeoli commented 3 years ago

Honestly, when we took over the plugin last year, that was something I did not test for, not has anyone brought it up until now. But in theory, a DJ should only be able to publish a post to the show they are assigned to. Thanks for catching this. We’ll have to take a look.

tonyzeoli commented 3 years ago

@majick777 Just thinking here that an Admin, Editor, and Producer, should be able to assign Posts to different shows. The only restriction would be on DJs themselves. But a DJ could be assigned to two or more shows, right? So, what do we do about that?

Maybe when the DJ is created and assigned to a show or shows, then if the DJ wants to post a blog post to one or many shows, there is a meta box on the Post editor page that shows the pages a DJ can post to. The check boxes would not be auto selected. The DJ would have to select them and if not, there's a warning that says a show must be seleteced to complete publishing of the post.

majick777 commented 3 years ago

This was a little more complex than first expected, especially since we have recently added Quick Edit and Bulk Edit abilities also, the code for those needed to be changed at the same time.

Basically anyone with a Administrator, Editor or Show Editor role can assign any posts to any Shows. And anyone who has a DJ/Host or Producer for a Show can also assign a post to it, and this was already possible to test via the existing Show editing capability (which revokes edit capability if not assigned to a Show) so I have simply made calls to current_user_can('edit_shows')

The tricky part was getting this to work in combination - say a Show Editor assigned a post to 2 Shows. Then a DJ comes along and sees it and needs to apply/unapply it to their Show also. Doing so needs to preserve any existing Shows assigned that the DJ does not have edit capability for. So this is what I've done.

The only thing is, DJs / Producers cannot see Posts that they are not actually Authors of, so something further may need to be considered on this front.

majick777 commented 3 years ago

@matzuras @tonyzeoli Going to close this issue as done as the reported problem has been resolved and included in the develop branch for next release.

matzuras commented 3 years ago

Wonderful news. I've been struggling with a workaround involving creating custom rules, but it's tedious with twenty-plus broadcasters. Can't wait for this one.

On 11/26/2020 9:57 PM, majick777 wrote:

@matzuras https://github.com/matzuras @tonyzeoli https://github.com/tonyzeoli Going to close this issue as done as the reported problem has been resolved and included in the develop branch for next release.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/netmix/radio-station/issues/276#issuecomment-734597811, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZRRNWNW2JT22A2IXMR6ETSR4IPJANCNFSM4TGCJ5SQ.

majick777 commented 3 years ago

@matzuras Feel free to test the development version earlier which has this in place, and report back if there are any further problems with it: https://netmix.com/radio-station/docs/FAQ/#how-do-i-install-the-latest-development-version-for-testing