Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-18723

Role required to display search box in /user/index.php is not appropriate

    Details

    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      The role required to display search box in /user/index.php is currently set to 'moodle/course:bulkmessaging'

      $bulkoperations = has_capability('moodle/course:bulkmessaging', $context);
      ...
      if ($bulkoperations && $totalcount > ($perpage*3))

      { echo '<form action="index.php"><div><input type="hidden" name="id" value="'.$course->id.'" />'.get_string('search').': '."\n"; echo '<input type="text" name="search" value="'.s($search).'" /> <input type="submit" value="'.get_string('search').'" /></div></form>'."\n"; }

      Displaying this search box should instead be restricted by something like '/moodle/site:viewparticipants'

      The simple fix is to change the above if statement to:

      if (has_capability('moodle/site:viewparticipants', $context) && $totalcount > ($perpage*3))

      { echo '<form action="index.php"><div><input type="hidden" name="id" value="'.$course->id.'" />'.get_string('search').': '."\n"; echo '<input type="text" name="search" value="'.s($search).'" /> <input type="submit" value="'.get_string('search').'" /></div></form>'."\n"; }

        Gliffy Diagrams

          Activity

          Hide
          evankroske Evan Kroske added a comment -

          I followed Mark's instructions to create this minor patch. I tested it, and I think it works.

          Show
          evankroske Evan Kroske added a comment - I followed Mark's instructions to create this minor patch. I tested it, and I think it works.
          Hide
          dongsheng Dongsheng Cai added a comment -

          Thanks Mark, please review

          Show
          dongsheng Dongsheng Cai added a comment - Thanks Mark, please review
          Hide
          mwebster Mark van Hoek added a comment -

          Looks good, Dongsheng - thanks a bunch !

          Show
          mwebster Mark van Hoek added a comment - Looks good, Dongsheng - thanks a bunch !

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                21/Oct/09