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

Extend get_users_by_capability to have a $useviewallgroups parameter

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Component/s: Roles / Access
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      In order to implement MDL-648 (see http://docs.moodle.org/en/Development:How_to_create_a_patch for a spec), we need to get users who:

      a) are in group $studentgroup and have capability mod/quiz:emailnotifysubmission in the context of a particular quiz, or
      b) are in any groups, and have capabilities mod/quiz:emailnotifysubmission and moodle/site:accessallgroups in the context of a particular quiz.

      You could do that with three calls to get_users_by_capability, then combine the results in PHP.

      Alternatively, you could change get_users_by_capability to optionally do the "in group $groups, or in any group and has moodle/site:accessallgroups". The attached patch does that.

      I have no idea what effect the attached patch will have on performance (when $useviewallgroups is false, when it is true, things will certainly be slower).

      The patch applies to Moodle 1.8 or HEAD.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              lazyfish Yu Zhang
              Reporter:
              timhunt Tim Hunt
              Tester:
              Nobody
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08