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

The function user_can_assign() in accesslib.php always returns false for administrators.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2.6, 2.3, 2.4
    • 2.2.7, 2.3.4, 2.4.1
    • Libraries
    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • wip-MDL-37026-master
    • Hide

      Test pre-requisites

      • A course with students enrolled in it.

      Test steps

      1. Navigate to the participants page of a course with students in it as the administrator.
        • Observe an icon for editing which will redirect you to the enrolment page.
      2. Change the current role to 'Teacher' or 'Student'.
        • The edit icon should still be present on the page.
      Show
      Test pre-requisites A course with students enrolled in it. Test steps Navigate to the participants page of a course with students in it as the administrator. Observe an icon for editing which will redirect you to the enrolment page. Change the current role to 'Teacher' or 'Student'. The edit icon should still be present on the page.

    Description

      While fixing an issues with icons I discovered that the edit icon for assigning roles on the participants page was not enabled for the administrator.

      After some further investigation I discovered the area where the problem lies.
      user_can_assign() calls get_user_roles(). get_user_roles() does a search on the role_assignments table which administrators are not entered into. It finds no records and so no permission is given for assigning roles.

      A change needs to be made in either of these functions (both in accesslib.php) to check for administrators.

      Attachments

        Issue Links

          Activity

            People

              abgreeve Adrian Greeve
              abgreeve Adrian Greeve
              Dan Poltawski Dan Poltawski
              Sam Hemelryk Sam Hemelryk
              Michael de Raadt Michael de Raadt
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/Jan/13