Needs review
Project:
UUID Features Integration
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Dec 2010 at 00:18 UTC
Updated:
28 Apr 2015 at 15:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
kenorb commentedYou can try:
http://drupal.org/project/backup_migrate
and choose only users table.
Check:
http://drupal.org/project/user_import
for importing
http://drupal.org/project/views_bonus
for exporting
See as well:
http://drupal.org/project/uuid_features
Comment #2
kenorb commentedComment #3
ezra-g commentedExporting user information is tricky because it needs to be done in a super secure way. In general, it's not great practice to commit things like passwords (even hashed ones) to version control, so I'm tempted to "won't fix" this feature in favor of other solutions.
Comment #4
kenorb commentedIf somebody have access to filesystem, probably this person has access to database as well and can read all the passwords.
Even if this person has no access to database, but only to file system, it's easy to add to index.php: db_query("SELECT * FROM {users}"); to get the same data which is exported.
So I don't see here any non-secure method of exporting.
Comment #5
netw3rker commentedwhen using user_save() you can't pass a hashed password in and *not* have that hash get hashed, so including password really can't happen w/o some technical work-arounds.
that being said, it does make a lot of sense to have an exported list of users that get recreated to do things like sanitize data from another environment, or ensure that certain developer accounts exist only on certain environments.
attached is a patch that adds user-uuid exportable support.
hope this helps!
-Chris
Comment #6
netw3rker commentednote that due to a bug in UUID's ability to save new users with a uuid, in order for the patch in #5 to function you must use the 6.x-1.x version of uuid and not the 6.x-1.0beta release.
-Chris
Comment #7
gregglesI don't think exporting passwords is a great idea. They aren't really portable across sites as of Drupal 7, and may not be portable in Drupal 6 depending on what password hash mechanism is used.
I suggest that this module not try to handle the password nor data column. The data column can contain a bucket of things that might be sensitive.
OR, this patch could have an option to handle passwords and the data column, but turn that off by default. Then during import it could check for this and, if they don't exist, insert a new random password.
Comment #8
netw3rker commented@greggles, I totally agree, the patch should already be excluding both password and data fields. beyond your reasons for the data field containing sensitive info, it contains very non-static information that would cause the feature to essentially always be marked as overridden; not a desired thing to have happen.
I like the idea of adding a setting for allowing for random passwording or something to that effect. I feel that this functionality would most likely be applied to dev/testing/qa env's where password security after sanitization is relatively a non-issue, so even allowing the password to be set to a fixed value is probably ok as long as the user can specify it.
Comment #9
codexmas commentedHere is a patch for the 7.x-1.x version of the module from the BADCamp 2012 Commons sprint for exporting users.
It seems to be working quite well but does need testing to ensure the majority of use cases are covered.
It does work with exporting existing users and updating their information if it has changed from the last time.
Roles also work when imported if they exist already.
Please take a look and let me know how it works for you.
One thing that needs a bit of work is some logic on determining an existing user. Using the UUID only results in potential unique conflicts on the name and mail fields. I was testing with a fresh install and the UUID on the admin account was different than my first export, highlighting the issue.
I have been thinking about potential workarounds and testing on all three using a first match principal.
The potential for importing users where a name/mail already exists is pretty high. This could mean overwriting a real account and at the very least causing some confusion. User accounts in this way are quite a lot different than content as the only unique fields on nodes is the nid.
Thoughts?
In the next patch I am going to be removing the $user->data field from being exported as well, let me know if there are any others that need pruning.
Cheers,
Gord Christmas, Acquia Technical Account Manager
Comment #10
kenorb commentedComment #11
ezra-g commentedThanks, codexmas!
I exported a test feature with some content and a user, and it appears to error out because it is trying to save the already existing user:
Bumping to the 7.x branch.
Comment #12
ezra-g commentedOn a site without the content or user, I tested the feature I created in #11 and get this error at admin/structure/features;
Comment #13
ezra-g commentedHere's the test feature I created.
Comment #14
codexmas commentedEzra, this appears to be an issue with how OgBehaviorHandler.class.php function og_group on line 1656:
It isn't testing that an actual entity is loaded and ends up passing:
The group has not been imported yet, so it appears this is partly an order of operations issue as well as Og assuming an entity is being loaded and not enough tests being performed.
Comment #15
ygerasimov commentedI have tested patch #9 and it works ok on clean installation of drupal
Comment #16
ygerasimov commentedthis probably should be $user = user_load();
Other than this I don't see any problems.
Comment #17
ygerasimov commentedHere is rerolled patch.
Comment #18
danithaca commentedHere's the rerolled patch that addresses #16. My IDE also found problem where $user should be $account.
Comment #19
PI_Ron commentedI used patch from #18 against the latest 1.x-dev and got this error after a cache clear:
Comment #20
netw3rker commented@PL_Ron, The re-roll in #18 is in the wrong format. It will need to be re-rolled. @danithica, could you try to re-roll using the p1 format?
Comment #21
milos.kroulik commentedIsn't this issue already solved by https://www.drupal.org/node/1973770 ?
Comment #22
kenorb commented