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

create_user web service function raises misleading exception when attempting to create a user that already exists

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not a bug
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Component/s: Web Services
    • Labels:
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      Steps to reproduce:

      Create a user from the REST web service, e.g.

      wget -O - http://yourmoodle/webservice/rest/server.php?wstoken=<yourwstoken> --post-data="wsfunction=moodle_user_create_users&users[0][username]=test01234&users[0][firstname]=Test&users[0][lastname]=Account&users[0][email]=test01234@example.com&users[0][auth]=manual&users[0][idnumber]=01234&users[0][city]=Perth&users[0][country]=AU&users[0][password]=<somepassword>"

      The first time you submit this data, you will get a response like the following:

      <?xml version="1.0" encoding="UTF-8" ?>
      <RESPONSE>
      <MULTIPLE>
      <SINGLE>
      <KEY name="id"><VALUE>99</VALUE>
      </KEY>
      <KEY name="username"><VALUE>test01234</VALUE>
      </KEY>
      </SINGLE>
      </MULTIPLE>
      </RESPONSE>

      Submit the data a second time.

      Expected result:

      An error message that indicates the user already exists

      Observed result:

      <EXCEPTION class="invalid_parameter_exception">
      <MESSAGE>Invalid parameter value detected, execution can not continue.</MESSAGE>
      </EXCEPTION>

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: