Forum OpenACS Development: Importing User IDs

Collapse
Posted by Malte Sussdorff on
We face the challange of importing a couple of users into OpenACS, which have a user_id in their old system that has already been propagated throughout various other systems.

How shall I go about this. Is there a way to create a user with a specific user_id? Or would it be better to use a mapping table / extend users / pray for more inspiration to achieve this result with all it's drawbacks (additional joins, confusion of developers).

Clearly it would be preferred to import the user_id into OpenACS as *the* user_id, but I'm not utterly sure about the implications.

Collapse
2: Re: Importing User IDs (response to 1)
Posted by russ m on
you can specify a user_id to ad_user_new - the intent was for double-click protection, but as long as the object_id you're after is available I guess you should be right...

hmmm, come to think of it you'll probably have a problem when the main object_id sequence reaches the user_ids you're assigning to the folks in question - perhaps the only safe way is if the current value of t_acs_object_id_seq is above the user_id values you want to hand out, and the object_id values you're after are not in use (the objects having been deleted or something)...

what "various other systems" are these values being used in? if there's already glue between them and this OACS instance then I'd think that using a mapping table is probably the cleanest way to go, all things considered...

Collapse
3: Re: Importing User IDs (response to 2)
Posted by Malte Sussdorff on
Hi russell, thanks a lot for the pointer, I guess we can just increase the object_id_seq to 100000 right when installing the system and be happy. Hmmm. still fairly reluctant to go down that road.

Not sure about the other systems myself. The idea is to get user data out of OpenACS with the user_id as an identifier and it should be the same for both systems.

Collapse
5: Re: Importing User IDs (response to 2)
Posted by Malte Sussdorff on
Okay, this trick will only work, if we make sure the sequence starts with 100.000 in the first place (so before installing OpenACS). Well, as Dirk mentioned in chat, I could just change the create sequence statement (what a fix....). Though now I can only HOPE that no piece of OpenACS is using hardcoded user_ids. Let's give it a roll...
Collapse
4: Re: Importing User IDs (response to 1)
Posted by Dirk Gomez on
If the user id has already been propated, you are well-advised to store them for later use.

Do you happen to know in which range the user ids of their old system are?

Collapse
6: Re: Importing User IDs (response to 1)
Posted by russ m on
You'd hope that the only magic object_id values are the ones from acs_magic_objects. I know that the user_id of the administrator created at installation has changed from aD ACS 4 -> OACS 4.5 -> OACS 4.6.3, presumably due to more objects being created during the initial installation, so I'd expect that anything that's making nasty assumptions about that sort of thing would break often enough to be fixed quickly.

rather than bumping the initial value of acs_object_id_seq before installing I'd probably do it during the first reboot (as long as the user_ids you want to use are higher than ~3000 or so), to at least keep the relative ordering of installation-created and post-installation-created objects the same as usual. You'd hope that nobody's making assumptions about that, but if they are I reckon it's less likely to have been caught.

good luck!