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

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.7.1, 3.3.1
    • None
    • Web Services
    • MOODLE_27_STABLE, MOODLE_33_STABLE
    • MDL-47783-master
    • 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.
      1. Ensure unit tests are passing.

    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

              Unassigned Unassigned
              jballard James Ballard
              Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              15 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated: