Wrong user is logged in through Drupal Embedded gallery

krwester

Joined: 2004-07-25
Posts: 12
Posted: Wed, 2006-01-11 03:47

My guess is that this problem is not easily solvable. But perhaps someone can point my in the right direction.

The problem.

When I log into my drupal installation (with the drupal gallery module installed), and I go to the gallery page, for some users the wrong user is logged into to gallery.

For example I log into drupal as "cooluser"
I look at the gallery page and I am logged in as "notsocool"

In addition the association is always the same way.
x gets logged in as y, and y gets logged in a z, every time.

I'm running gallery 2.02
Gallery module from drupal (from cvs, but the standard had the same problem)
Drupal 4.6.5

Thanks as always for your help.

.ps other than that everything works fine.

 
kiz_0987

Joined: 2005-02-27
Posts: 189
Posted: Wed, 2006-01-11 11:30

This can happen if "cooluser" is the admin user (uid=1) in Drupal but originally this username was not present in G2. In this case, the oldest admin in G2 is used to make the G2-Drupal user association, which would be "notsocool". Is this what happened? This should only happen with one user though.

 
krwester

Joined: 2004-07-25
Posts: 12
Posted: Wed, 2006-01-11 12:58

No, in fact when the admin user logs in it works fine. It is with a whole bunch of the other users that it does not work.

On a related note, when I try to create a new user in drupal, I get a fatal error saying that it could not create the user in gallery. However, when I check the gallery Database, the user has been added successfuly, and I can log into the main gallery installation. And then I can log in successfully into drupal, but the problem described in the first post occurs.

And for completeness the errors given in watchdog are as follows:

Error creating Gallery user
Error (ERROR_STORAGE_FAILURE)
in modules/core/classes/GalleryStorage/DatabaseStorage.class at line 1238 (gallerystatus::error) 
in modules/core/classes/GalleryStorage.class at line 294 (mysqldatabasestorage::addmapentry) 
in modules/core/classes/interfaces/ExternalIdMap.inc at line 96 (gallerystorage::addmapentry) 
in modules/core/classes/GalleryEmbed.class at line 311 (externalidmap::addmapentry) 
in<MYDIRECTORY>/modules/gallery/gallery.module at line 86 (galleryembed::createuser) 
in<MYDIRECTORY>/modules/user.module at line 19
in<MYDIRECTORY>/modules/user.module at line 181
in<MYDIRECTORY>/modules/user.module at line 1317
in<MYDIRECTORY>/modules/user.module at line 1692
in ??? at line 0
in<MYDIRECTORY>/includes/menu.inc at line 354
in<MYDIRECTORY>/index.php at line 18

And

Duplicate entry '42-GalleryUser' for key 1 query: 
INSERT INTO watchdog (uid, type, message, severity, link, location, hostname, timestamp) 
VALUES (1, 'gallery', 'Error creating Gallery user<br/>Error (ERROR_STORAGE_FAILURE)<ul><li><b>in</b> 
modules/core/classes/GalleryStorage/DatabaseStorage.class <b>at line</b> 1238 (gallerystatus::error) 
<li><b>in</b> modules/core/classes/GalleryStorage.class <b>at line</b> 294 (mysqldatabasestorage::addmapentry) 
<li><b>in</b> modules/core/classes/interfaces/ExternalIdMap.inc <b>at line</b> 96 (gallerystorage::addmapentry) 
<li><b>in</b> modules/core/classes/GalleryEmbed.class <b>at line</b> 311 (externalidmap::addmapentry) 
<li><b>in</b><MYDIRECTORY>/modules/gallery/gallery.module <b>at line</b> 86 (galleryembed::createuser) 
<li><b>in</b> /home/.katana/krwester/westerme in<MYDIRECTORY>/includes/database.mysql.inc on line 66

As always, thank you for your help. I've been pulling my hair out on this one.

 
kiz_0987

Joined: 2005-02-27
Posts: 189
Posted: Wed, 2006-01-11 17:00

I had a problem similar in some ways when I was using multi-site Drupal and G2 and specified the wrong G2 location for one of my sites so that it started using the wrong database. Unlikely, but you never know.

If you can check/change the Gallery database then you should be able to fix up your users manually (back it up first!) assuming you do not have many. You need to change the g2_ExternalIdMap entries so that g_externalId (=Drupal User ID) is correctly aligned with g_entityId (Gallery User ID) which you can find from the g2_User table. Once it's working, try creating a new user and see if it starts to work. Somewhere it sounds like it has got confused, but I have not seen this on a normal installation of gallery.module.

 
krwester

Joined: 2004-07-25
Posts: 12
Posted: Wed, 2006-01-11 17:59

That was in fact the problem. THANK YOU!

I kept looking for some table that did that, but I had been unsuccesful. I'm a happy gallery user again :).