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

User profile fields uniqueness don't work while user importing

    XMLWordPrintable

Details

    • MOODLE_311_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_400_STABLE
    • MOODLE_311_STABLE
    • MDL-64770-311
    • Hide

      Setup

      1. Log in as admin
      2. Navigate to Users > Accounts > User profile fields in site administration
      3. Create a new Text input profile field
        • Short name: myfield
        • Name: My field
        • Should the data be unique: No
      4. Create another new Text input profile field
        • Short name: myuniquefield
        • Name: My unique field
        • Should the data be unique: Yes
      5. Create a new user:
        • Username: user01
        • My field: Tomato
        • My unique field: Rabbit

      1. Regression test for duplicating existing data in unique field (MDL-40881)

      1. Navigate to Users > Accounts > Upload users in site administration
      2. Upload MDL-64770-1.csv
      3. Confirm you see the following in the Status column:

        This value has already been used. (profile_field_myuniquefield)
        

      2. Test uploading new duplicated data to unique field

      1. Navigate to Users > Accounts > Upload users in site administration
      2. Upload MDL-64770-2.csv
      3. Confirm you see the following in the Status column of the second row:

        This value has already been used. (profile_field_myuniquefield)
        

      3. Test uploading new non-duplicated data to unique field

      1. Navigate to Users > Accounts > Upload users in site administration
      2. Upload MDL-64770-3.csv
      3. Confirm both users are created with correct My unique field value

      4. Test uploading new duplicated data to non-unique field

      1. Navigate to Users > Accounts > Upload users in site administration
      2. Upload MDL-64770-4.csv
      3. Confirm both users are created with correct My field value
      Show
      Setup Log in as admin Navigate to Users > Accounts > User profile fields in site administration Create a new Text input profile field Short name: myfield Name: My field Should the data be unique: No Create another new Text input profile field Short name: myuniquefield Name: My unique field Should the data be unique: Yes Create a new user: Username: user01 My field: Tomato My unique field: Rabbit 1. Regression test for duplicating existing data in unique field ( MDL-40881 ) Navigate to Users > Accounts > Upload users in site administration Upload MDL-64770-1.csv Confirm you see the following in the Status column: This value has already been used. (profile_field_myuniquefield) 2. Test uploading new duplicated data to unique field Navigate to Users > Accounts > Upload users in site administration Upload MDL-64770-2.csv Confirm you see the following in the Status column of the second row: This value has already been used. (profile_field_myuniquefield) 3. Test uploading new non-duplicated data to unique field Navigate to Users > Accounts > Upload users in site administration Upload MDL-64770-3.csv Confirm both users are created with correct My unique field value 4. Test uploading new duplicated data to non-unique field Navigate to Users > Accounts > Upload users in site administration Upload MDL-64770-4.csv Confirm both users are created with correct My field value

    Description

      Defining new user profile field there are several options:

      • Is this field required? YES/NO
      • Is this field locked? YES/NO
      • Should the data be unique? YES/NO
      • Display on signup page? YES/NO
      • Who is this field visible to? NOT VISIBLE/VISIBLE TO USER/VISIBLE TO EVERYONE

      It seems that user profile fields uniqueness does not work when users are imported from a file (tested with current users data update, not creating new one). There are even no any warning about this.

      What do you think about this behavior? This is a bug or not in your opinion? 

      How to reproduce?

      1. Make sure that you have at least two users on your Moodle site.
      2. ADMIN: Add new user profile field: Site administration -> Users -> Accounts -> User profile fields; required options:
        • Should the data be unique? YES
      3. ADMIN: Site administration -> Users -> Accounts -> Bulk user actions
        • Selected user list... Add all
        • With selected users... Download -> Go -> Download
      4. Type the same value for at least two user for user profile field defined in 2.
      5. ADMIN: Select changed file with users on Site administration -> Users -> Accounts -> Upload users
        • Upload type: Update existing users only
        • Existing user details: Override with file
      6. User profile fields values for at least 2 users will be duplicated

      Attachments

        1. moodle-user-profile-fields.png
          moodle-user-profile-fields.png
          17 kB
        2. MDL-64770-1.csv
          0.1 kB
        3. MDL-64770-2.csv
          0.1 kB
        4. MDL-64770-3.csv
          0.1 kB
        5. MDL-64770-4.csv
          0.1 kB
        6. Test 1_Screenshot.PNG
          Test 1_Screenshot.PNG
          19 kB
        7. Test 2_Screenshot.PNG
          Test 2_Screenshot.PNG
          21 kB
        8. Test 3_Screenshot.PNG
          Test 3_Screenshot.PNG
          18 kB
        9. Test 4_Screenshot.PNG
          Test 4_Screenshot.PNG
          18 kB

        Issue Links

          Activity

            People

              pholden Paul Holden
              lukasz Łukasz Szeremeta
              Carlos Escobedo Carlos Escobedo
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Gladys Basiana Gladys Basiana
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/Mar/22

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h