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

core_user_update_users silently fails when updating email to an already existing one

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Waiting for peer review
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7.6, 3.8.4, 3.9.1
    • Fix Version/s: None
    • Labels:
    • Testing Instructions:
      Hide

      Requires the admin to have a web service set up for users updating

      1) Create user1 with email foo@bar.com;
      2) Create user2 with email pee@wee.com;
      3) Enable web services and configure a third user with proper permissions (problem occurs even if this user is a site administrator);
      4) Call WS function core_user_update_users() to change user2's email to foo@bar.com.
      5) Make sure the function now returns an array of warnings, the array contains the item with a 'duplicate email' message for user2 and his id.

      Show
      Requires the admin to have a web service set up for users updating 1) Create user1 with email foo@bar.com; 2) Create user2 with email pee@wee.com; 3) Enable web services and configure a third user with proper permissions (problem occurs even if this user is a site administrator); 4) Call WS function core_user_update_users() to change user2's email to foo@bar.com. 5) Make sure the function now returns an array of warnings, the array contains the item with a 'duplicate email' message for user2 and his id.
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-69194-core_user_update_users

      Description

      WS function core_user_update_users() fails to update a user's email attribute when the new email is already assigned to another user.  I understand this is the default behaviour for a brand new Moodle instance, but the problem is, it doesn't return any error message or exception.  I can successfully update other attributes such as firstname and password, so I believe it's not an issue with permissions or my programming.

      Steps to reproduce:
      1) Create user1 with email foo@bar.com;
      2) Create user2 with email pee@wee.com;
      3) Enable web services and configure a third user with proper permissions (problem occurs even if this user is a site administrator);
      4) Call WS function core_user_update_users() to change user2's email to foo@bar.com.

      What I expected:
      User2's email is not changed and WS call returns an error like "duplicate email" or "invalid parameter".

      What actually happens:
      User2's email is not changed and WS call returns nothing.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            rafaelavila Rafael Avila
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 minute
                1m