Moodle
  1. Moodle
  2. MDL-32485

Course content inaccessible when groupmembersonly is enabled, but no grouping is set

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.2.1, 2.3.3, 2.4
    • Fix Version/s: STABLE backlog
    • Component/s: Groups
    • Labels:
    • Testing Instructions:
      Hide
      1. Go to Site administration > Development > Experimental > Experimental settings and click "Enable group members only"
      2. Go to course and upload course content. In the "Common module settings" section, click "Show advanced" and click "Available for group members only", but select "None" for the grouping.
      3. Go to course settings and enable guest access
      4. Visit course as guest user
        1. EXPECTED: You can see the uploaded course content
        2. ACTUAL: You do not see the uploaded course content

      The regular testing for groupings and groupmembersonly should be performed as well to ensure no regressions.

      Show
      Go to Site administration > Development > Experimental > Experimental settings and click "Enable group members only" Go to course and upload course content. In the "Common module settings" section, click "Show advanced" and click "Available for group members only", but select "None" for the grouping. Go to course settings and enable guest access Visit course as guest user EXPECTED: You can see the uploaded course content ACTUAL: You do not see the uploaded course content The regular testing for groupings and groupmembersonly should be performed as well to ensure no regressions.
    • Workaround:
      Hide

      Manually uncheck groupmembersonly setting or run following sql command:

      UPDATE mdl_course_modules 
      SET groupmembersonly = 0
      WHERE groupingid = 0 AND groupmembersonly = 1
      
      Show
      Manually uncheck groupmembersonly setting or run following sql command: UPDATE mdl_course_modules SET groupmembersonly = 0 WHERE groupingid = 0 AND groupmembersonly = 1
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull 2.4 Branch:
    • Pull Master Branch:
    • Rank:
      39376

      Description

      Hello all,

      when enabling the enablegroupmembersonly - flag in Experiemental settings the course content is completely disappeared for role participant.

      I found that there must be going wrong in update_user_visible()

      The debugger jumps into

      else if (!empty($CFG->enablegroupmembersonly) and !empty($this->groupmembersonly)
                      and !has_capability('moodle/site:accessallgroups', $modcontext, $userid)) {
                  $groups = $this->modinfo->get_groups($this->groupingid);
      .....
      

      Then group is empty... so that uservisible is set to "false"

      In the corresponding course there is NO group setting done.
      That makes no sense.
      Hope somebody can help...

        Activity

        Hide
        Stefan L added a comment -

        This seems to be an problem of Moodle update from 1.9 to 2.2.
        The DB - field course_modules->groupmembersonly has different/wrong settings for moodle 2.2.
        It's settings: zerofill: enabled; tinyint(4)
        Moodle 2.2 misinterprets the zerofills which produces that strange behaviour.

        Disabling the zerofill - option and setting the default - value to '0' solves the problem.

        Show
        Stefan L added a comment - This seems to be an problem of Moodle update from 1.9 to 2.2. The DB - field course_modules->groupmembersonly has different/wrong settings for moodle 2.2. It's settings: zerofill: enabled; tinyint(4) Moodle 2.2 misinterprets the zerofills which produces that strange behaviour. Disabling the zerofill - option and setting the default - value to '0' solves the problem.
        Hide
        Michael de Raadt added a comment -

        Thanks for discovering that and pointing to a cause.

        I've put that on the backlog.

        In the meantime feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a patch label so we will spot it.

        Show
        Michael de Raadt added a comment - Thanks for discovering that and pointing to a cause. I've put that on the backlog. In the meantime feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a patch label so we will spot it.
        Hide
        Rex Lorenzo added a comment -

        Attached a patch and awaiting peer review/integration.

        Show
        Rex Lorenzo added a comment - Attached a patch and awaiting peer review/integration.
        Hide
        Rex Lorenzo added a comment -

        Made another commit:

        Changed module form to disable "Available for group members only" if "None" grouping is chosen
        https://github.com/rlorenzo/moodle/commit/9e8e3270c2eb761d7ba8ab765603deda5f0b3f8d

        This will help prevent someone from shooting themselves in the foot for choosing "Available for group members only", but had no grouping. But my question is, should we change the logic for displaying? Should we continue to hide content that had "Available for group members only" selected with no grouping? It might make content that was previously hidden to be available for guest users now. If that is not okay, during integration only the second commit on the branch can be integrated and not the commit that "fixes" the logic.

        Show
        Rex Lorenzo added a comment - Made another commit: Changed module form to disable "Available for group members only" if "None" grouping is chosen https://github.com/rlorenzo/moodle/commit/9e8e3270c2eb761d7ba8ab765603deda5f0b3f8d This will help prevent someone from shooting themselves in the foot for choosing "Available for group members only", but had no grouping. But my question is, should we change the logic for displaying? Should we continue to hide content that had "Available for group members only" selected with no grouping? It might make content that was previously hidden to be available for guest users now. If that is not okay, during integration only the second commit on the branch can be integrated and not the commit that "fixes" the logic.
        Hide
        Adrian Greeve added a comment -

        Hello Rex,

        I know that it has been a while since anyone has looked at this issue, but would it be okay if I put you as the assignee for this issue and then put it up for peer-review? Just so that we can get some movement on this issue. If not then maybe we can look at some other alternative.

        Thanks.

        Show
        Adrian Greeve added a comment - Hello Rex, I know that it has been a while since anyone has looked at this issue, but would it be okay if I put you as the assignee for this issue and then put it up for peer-review? Just so that we can get some movement on this issue. If not then maybe we can look at some other alternative. Thanks.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: