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

    • Icon: Bug Bug
    • Resolution: Not a bug
    • Icon: Major Major
    • None
    • 2.0.1
    • Web Services
    • MOODLE_20_STABLE

      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>

            jerome Jérôme Mouneyrac
            chrisf Chris Fryer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.