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

    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-25027_stable_consistency_fix
    • Testing Instructions:
      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

              Assignee:
              nebgor Aparup Banerjee
              Reporter:
              ashleyholman Ashley Holman
              Peer reviewer:
              Sam Hemelryk Sam Hemelryk
              Integrator:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tester:
              Rajesh Taneja Rajesh Taneja
              Participants:
              Component watchers:
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/Mar/12