Forcing group sync with Drupal

stephthegeek

Joined: 2004-08-21
Posts: 33
Posted: Mon, 2006-06-05 15:39

Need help!! I have a G2 installation within Drupal 4.7. I imported users from another board so they did not synchronize with Gallery's groups. New users are syncing fine with the correct roles. However, imported users show this error and they do not get the correct Gallery groups:

Error updating Gallery user
Error (ERROR_COLLISION)

* in modules/core/classes/GalleryUser.class at line 154 (GalleryCoreApi::error)
* in modules/core/classes/GalleryEmbed.class at line 360 (GalleryUser::create)
* in /var/www/v6.stephthegeek.com/public_html/modules/gallery/gallery_user.inc at line 137 (GalleryEmbed::createUser)
* in /var/www/v6.stephthegeek.com/public_html/modules/gallery/gallery_user.inc at line 66
* in /var/www/v6.stephthegeek.com/public_html/modules/gallery/gallery.module at line 84
* in /var/www/v6.stephthegeek.com/public_html/modules/user.module at line 19
* in /var/www/v6.stephthegeek.com/public_html/modules/user.module at line 108
* in /var/www/v6.stephthegeek.com/public_html/modules/user.module at line 1438
* in ??? at line 0
* in /var/www/v6.stephthegeek.com/public_html/includes/form.inc at line 189
* in /var/www/v6.stephthegeek.com/public_html/includes/form.inc at line 122
* in /var/www/v6.stephthegeek.com/public_html/modules/user.module at line 1419
* in ??? at line 0
* in /var/www/v6.stephthegeek.com/public_html/includes/menu.inc at line 418
* in /var/www/v6.stephthegeek.com/public_html/index.php at line 15

Is there a way to force a synchronization with Drupal -> Gallery's groups?

I just realized this on a live site and would appreciate any assistance asap! Thank you!

 
kiz_0987

Joined: 2005-02-27
Posts: 189
Posted: Mon, 2006-06-05 16:11

As the error suggests, there is a collision in the syncing process. One way to fix this is to manually correct the 'g2_externalidmap' which is the table that maps the drupal and gallery2 users. Once this is done the roles/groups should sync once the user is modified in drupal. Note that the drupal roles are the ones being synced with gallery2 groups -- the master here is drupal, there will be no gallery2 groups being converted into drupal roles.

 
stephthegeek

Joined: 2004-08-21
Posts: 33
Posted: Mon, 2006-06-05 16:30

Thank you. Yes.. I need Drupal roles to be transferred to Gallery users.

I'm not sure what you mean by "manually correct". There are 6,185 records in that table, and I have 7,849 users, which actually makes sense because there were about 1700 users added in the last round and those would be the ones that are not in the correct groups in Gallery. So I need to do a manual correction to grab all uids from Drupal and insert into g2_ExternalIdMap?

 
kiz_0987

Joined: 2005-02-27
Posts: 189
Posted: Mon, 2006-06-05 16:41

Ah, you have a lot of users! This will make it difficult to manually correct. It is not clear to me why the original sync failed. Do all the current users have the ERROR_COLLISION or is it only a few? These are the ones that need correcting. For the ones that do appear to work, is the gallery2 user actually correct for the drupal user?

 
stephthegeek

Joined: 2004-08-21
Posts: 33
Posted: Mon, 2006-06-05 16:54

It looks like it's only the ones from the latest import. I see how this should be working but there aren't enough users in the g2_ExternalIdMap table, so it looks like they weren't added.

Yes the rest appear to be correct.

 
kiz_0987

Joined: 2005-02-27
Posts: 189
Posted: Mon, 2006-06-05 17:40

How are you importing the users? There is no bulk sync (yet) for drupal->Gallery2 users, each will sync when modified individually.

 
stephthegeek

Joined: 2004-08-21
Posts: 33
Posted: Mon, 2006-06-05 17:58

Those were imported manually, from another application called aMember. I needed to update the Drupal roles too so it was done manually through SQL.

Ok so I think I just need to do a query in the same kind of way. So, g_externalId needs to be updated with their Drupal uid, g_entityType to GalleryUser, and g_entityId autoincrement to the next # to be used as their Gallery id?

 
kiz_0987

Joined: 2005-02-27
Posts: 189
Posted: Mon, 2006-06-05 18:27

I do not think you can simply auto-increment the g_entityId as everything in Gallery2 has a g_entityId (albums, photos, ...). You need to find the correct Gallery2 user, get their uid and use that as the g_entityId.

 
stephthegeek

Joined: 2004-08-21
Posts: 33
Posted: Mon, 2006-06-05 18:38

There are no Gallery2 users for these people. There are only 6179 records in g2_User.

 
stephthegeek

Joined: 2004-08-21
Posts: 33
Posted: Thu, 2006-06-08 23:37

I've also now tried deleting the users in Gallery, but they are not being updated when the user logs in to Drupal and now have no access to Gallery whatsoever. Users are also causing the above collision errors upon login. I have no idea if account info/roles are even being updated. But it seems to be working for *some* users (50 out of 450 right now, and the number is slowly increasing... perhaps as people are logging in?).

What exactly *should* the data look like?

 
kiz_0987

Joined: 2005-02-27
Posts: 189
Posted: Fri, 2006-06-09 12:32

stephthegeek - would you be willing to set up an admin account in drupal and Gallery2 so that I can try to understand what is going on here? If so, please PM me the details.

Thanks.