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

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.6, 2.3, 2.4
    • Fix Version/s: 2.2.7, 2.3.4, 2.4.1
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-37026-master

      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

              Assignee:
              abgreeve Adrian Greeve
              Reporter:
              abgreeve Adrian Greeve
              Peer reviewer:
              Dan Poltawski
              Integrator:
              Sam Hemelryk
              Tester:
              Michael de Raadt
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Jan/13