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

Missing validation on short name in role creation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.4, 3.4, 3.5
    • Fix Version/s: 3.3.5, 3.4.2
    • Component/s: Roles / Access
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-61224_master

      Description

      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 
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              markn Mark Nelson
              Reporter:
              markn Mark Nelson
              Peer reviewer:
              Sara Arjona (@sarjona)
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Gladys Basiana
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                19/Mar/18