moodleou/moodle-mod_oublog

mod_oublog: nopermissions error when editing own post on a Visible group

Opened this issue · 0 comments

Hi Team,

Environment:
Moodle 3.9.2+ (Build: 20201030)
mod_oublog: 2020050800

Please see replication below:

  1. Create a course and enrol a student.
  2. Create a group and add the student onto it.
  3. Turn editing on.
  4. Add an OU blog activity and set Common module settings / Group mode = Visible groups.
  5. Log out and then log in as the student user.
  6. Go to the OU blog activity and ensure that the visible groups dropdown shows the group that you are a member of.
  7. Click the "New blog post" button and add a post.
  8. Now back on the oublog activity, select "All participants" in the Visible groups dropdown.
  9. You will still see your previous post.
  10. Click "Edit" link.
    You will get the message.
Sorry, but you do not currently have permissions to do that (Access all groups).
More information about this error
×Debug info:
Error code: nopermissions
×Stack trace:
line 870 of /lib/accesslib.php: required_capability_exception thrown
line 129 of /mod/oublog/editpost.php: call to require_capability()

I think this is because of the condition: mod/oublog/editpost.php

if ($groupmode == VISIBLEGROUPS && !groups_is_member($currentgroup) && !$correctinvidualsetting) {
    require_capability('moodle/site:accessallgroups', $context);
}

but if the post is owned/created by the owner, then should we consider allowing it even if Visible group is set to "All participants"

Thank you.