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

core_user_get_users does not return user details for normal user accounts

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.7.1, 3.3.1
    • Fix Version/s: None
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      1. Ensure unit tests are passing.
    • Workaround:
      Hide

      Add the Web Service user created above to the list of "Site Administrators"
      /admin/roles/admins.php

      This supersedes the failed permission criteria.

      Show
      Add the Web Service user created above to the list of "Site Administrators" /admin/roles/admins.php This supersedes the failed permission criteria.
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-47783-master

      Description

      When using core_user_get_users (via REST in this case) it appears impossible to get values returned unless the web service user is given system admin privileges.

      This appears to be caused by the call to user_get_user_details_courses($user) in /user/externallib.php [line 516 in 2.7.1]

      This function will only return details if one of the following is satisfied:

      1. can_view_user_details_cap($user)
      2. ($user->id == $USER->id)
      3. has_coursecontact_role($user->id)

      Criteria 1 can only be satisfied if the web service user is assigned to every other user in the user context or by adding a course parameter option to the web service call - neither seem necessary although course id = 1 could be used in the latter case.

      Criteria 2 is rarely satisfied as the web service user is unlikely to be interested in finding themselves.

      Criteria 3 is not satisfied unless the Web Service user is listed as a course contact, which isn't appropriate in general.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jballard James Ballard
              Participants:
              Component watchers:
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              15 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated: