The expected behavior for the documentation is that when a file is uploaded with existing users their roles are updates based on the importer settings.

Settings applied for user processor are:
Replace existing users: Checked
Skip hash check: Unchecked
Status: Active

Additional Roles:
Checked OnDemand (a custom role for us)

Field mapping
Used Email Address as unique

Expected behavior is the uploaded users roles are changed or or 'ondemand' is selected.

What actually happens all files are updated but user role remains uneffected.

The above may me correct but the wording in the UI at the moment suggests it is not.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikran’s picture

Version: 7.x-2.0-alpha7 » 7.x-2.0-alpha8
Component: Feeds Import » Code
Assigned: Unassigned » mikran

I have exactly same importer settings as you do. For me the current behaviour is what I want but the import process is throwing errors:

Invalid argument supplied for foreach() user.module:523
array_merge(): Argument #1 is not an array user.module:458
Undefined property: stdClass::$roles user.module:517
Undefined property: stdClass::$roles user.module:523
array_keys() expects parameter 1 to be array, null given user.module:523

I'll further investigate this why tests are allowing this to happen.

mikran’s picture

Version: 7.x-2.0-alpha8 » 7.x-2.x-dev
Status: Active » Needs review
FileSize
495 bytes

Here is test demonstrating the warnings I'm receiving. The issue is with "Replace existing users" setting.

Status: Needs review » Needs work

The last submitted patch, replace_existing_roles-7414336-2.patch, failed testing.

mikran’s picture

Status: Needs work » Needs review
FileSize
1.72 KB
1.19 KB

Here we go with a fix and better tests.

mikran’s picture

Fixed defaults to config values instead of empty.

kalidasan’s picture

In my local system I have created one importer to create 1000 users under one custom role.

I created 1000 users successfully in my local system.

When I export this importer to my development server, unfortunately (May be the Bug) user role is un-checked against my custom role.

See this link for "How to import importer".

With out double check it, I tried to create 1000 users in dev server. Every data is created except role.

Then I checked user role and executed the importer again.

At that time role its not updating.

But when I deleted one user and created again, then role is updated.

This is the issue I have faced while import.

Alexander Hadj Hassine’s picture

Issue summary: View changes

You make my day!

MegaChriz’s picture

Title: User Import does not update role » User import does not replace roles with "Additional roles" when replacing existing users
Related issues: +#1376774: User Processor - add mapping target for user roles
MegaChriz’s picture

Now that #1376774: User Processor - add mapping target for user roles is in, here is an updated patch. The code for the automated test has been moved to a new test method called testAdditionalRolesSettingWhenReplacingUsers(). As I got PHP notices about $user->data during manual testing, I added code to unserialize the "data" property on the user object.

Also included a tests-only patch which should fail tests.

The last submitted patch, 9: feeds-reset-roles-on-replace-1894542-9-tests-only.patch, failed testing.

  • MegaChriz committed 79b791f on 7.x-2.x
    Issue #1894542 by mikran, MegaChriz: Fixed replace roles with "...
MegaChriz’s picture

Status: Needs review » Fixed

Committed #9.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.