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

Web Service moodle_user_create_users() does not accept leading/trailing spaces in firstname / lastname

    XMLWordPrintable

Details

    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MDL-25027_stable_consistency_fix
    • Hide

      1) turn on web services under advanced features.
      2) plugins->web services -> external services , create a web service
      3) define in the GUI, a web services function that creates moodle users using 'moodle_user_create_users'
      4) call the web service with a web services test client (some can be cloned from here : git@github.com:moodlehq/sample-ws-clients.git )
      5) check that it can create firstname and lastnames with spaces in it.

      Please test MDL-30878 also. Part of this patch was removed for testing MDL-30878.

      Show
      1) turn on web services under advanced features. 2) plugins->web services -> external services , create a web service 3) define in the GUI, a web services function that creates moodle users using 'moodle_user_create_users' 4) call the web service with a web services test client (some can be cloned from here : git@github.com:moodlehq/sample-ws-clients.git ) 5) check that it can create firstname and lastnames with spaces in it. Please test MDL-30878 also. Part of this patch was removed for testing MDL-30878.

    Description

      Users can be added with leading/trailing spaces in firstname and lastname via the GUI form. However, the same values submitted via web services will cause an exception to be thrown.

      This appears to be because the create_users service runs the data through truncate_userinfo() and throws an exception if it is returned modified in anyway. truncate_userinfo() has a call to trim() which strips the spaces. The fields are of type PARAM_NOTAGS which allows the spaces.

      Attachments

        Issue Links

          Activity

            People

              nebgor Aparup Banerjee
              ashleyholman Ashley Holman
              Sam Hemelryk Sam Hemelryk
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Rajesh Taneja Rajesh Taneja
              Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/Mar/12