Moodle

A couple bugs in accesslib.php

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Roles / Access
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

While working on MDL-20045, I noticed a couple of bugs in the current accesslib.php in Moodle 2.0:

  • get_child_contexts sometimes returns a record set instead of an array, which is what the documentation states it is. This breaks get_role_context_caps, since it passes the return value of get_child_contexts to array_keys. In addition, the record set has already been iterated through, and cannot be rewound. (In Moodle 1.9, the record sets were copied to an array, and the array was returned).
  • fetch_context_capabilities for blocks and modules searches for records that have the component equal to "block/..." and "mod/..." respectively. However in Moodle 2.0, the format seems to have been changed to "block_..." and "mod_...". ("_" instead of "/".)

Activity

Hide
Andrew Davis added a comment -

Fixed both of those. Well spotted.

Show
Andrew Davis added a comment - Fixed both of those. Well spotted.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: