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

Missing validation on short name in role creation

XMLWordPrintable

    • MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • MDL-61224_master
    • Hide

      Test with both BOOST and CLEAN themes

      1. Visit ‘Site administration’ > ‘Users’ > ‘Define roles’.
      2. Click to ‘Add a new role’.
      3. Click ‘Continue’ on next page.
      4. Check that you can not add more than 100 characters to the short name input field.
      5. Use a browser editor to change the DOM and change 'maxlength' on the input field to 255.
      6. Add a role with the short name that exceeds 100 characters.
      7. Ensure you get a warning (the message is different for each theme).
      8. Add a role with the short name that does not exceed 100 characters.
      9. Ensure it is created as expected.
      Show
      Test with both BOOST and CLEAN themes Visit ‘Site administration’ > ‘Users’ > ‘Define roles’. Click to ‘Add a new role’. Click ‘Continue’ on next page. Check that you can not add more than 100 characters to the short name input field. Use a browser editor to change the DOM and change 'maxlength' on the input field to 255. Add a role with the short name that exceeds 100 characters. Ensure you get a warning (the message is different for each theme). Add a role with the short name that does not exceed 100 characters. Ensure it is created as expected.

      If you add a role with a shortname that exceeds 100 characters you get the following -

      Debug info: ERROR: value too long for type character varying(100)
      UPDATE mdl_role SET name = $1,shortname = $2,description = $3,sortorder = $4,archetype = $5 WHERE id=$6
      [array (
      'name' => 'sd',
      'shortname' => 'ashortnamewith100cshars111111111111111111111111111111111111111111111111111111111111111111111111111111',
      'description' => '',
      'sortorder' => '10',
      'archetype' => '',
      0 => '10',
      )]
      Error code: dmlwriteexception 
      

            markn Mark Nelson
            markn Mark Nelson
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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