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

load_subcontext duplicates the role assignments at course level in $accessdata['ra']

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 1.9.3
    • Fix Version/s: None
    • Component/s: Roles / Access
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      I am looking at line 1313 of accesslib.php, the bit following the comment "// Read in the RAs, preventing duplicates" in load_subcontext. In the case where you are call this with a course context, the the role assignments for this context level are already loaded, but the code does not check for this. Therefore I am seeing things like this:

      Array
      (
      [ra] => Array
      (
      [/1/3/49] => Array
      (
      [0] => 3
      )

      [/1/3/48/20] => Array
      (
      [0] => 3
      [1] => 3
      )

      [/1] => Array
      (
      [0] => 7
      )

      [/1/2] => Array
      (
      [0] => 5
      )

      )

      This does not hurt, apart from, perhaps, causing wasted effort later - except that some display code I have just written does not like this.

      I am thinking of adding a array_unique call to fix this.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                timhunt Tim Hunt
                Reporter:
                timhunt Tim Hunt
                Tester:
                Nobody
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: