Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-21432 META: Backup & restore 2.0
  3. MDL-23400

api: modify get_assignable_roles() to support user param

    XMLWordPrintable

    Details

    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      When restoring one course we need to know the roles that are assignable by a given user. That's addressed by the get_assignable_roles() function.

      The problem is that the function always returns the assignable roles for the current session user ($USER). And restore requires all permissions to be evaluated by the given user (that for sure will match $USER on interactive executions but can be different in other types of executions - cron/customs...).

      So I'm going to modify the get_assignable_roles() function, 100% BC

      • adding one new 4th parameter $user (default null)
      • if null, $USER will be used
      • if object/id, $user will be used

      Ciao

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stronk7 Eloy Lafuente (stronk7)
                Reporter:
                stronk7 Eloy Lafuente (stronk7)
                Tester:
                Nobody
                Participants:
                Component watchers:
                Adrian Greeve, Mihail Geshoski, Peter Dias, Jake Dallimore, Jun Pataleta, Ryan Wyllie, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  24/Nov/10