Saturday, October 09, 2010

#plone helps solve user import issue.

One of the key functionalities I need from plone is to be able to import a batch of users as at the start of each year I've go a fresh crew to install (3-4 hundred users this year).  While I wish there were some way that I could set my authentication to the district AD servers and when someone logged in for the first time it would set up new local accounts on my plone server, able to be managed locally, it doesn't look like that functionality is around.


So, I went on #plone at the suggestion of my WebLion friends and I've gotten some good direction.  The dialog below shows the second time I visited the chat room for help on this topic.  In the end (now almost 2 weeks after the below dialog) I've given up on this for a variety of reasons related to my lack of knowledge and time to gain it (couldn't get a fresh install with same buildout to work).

So, over this last week I have had students join as 'new users'.  This is always a painful process with incorrect login names (though of course I liked that God became a user on my site ;)) but now have my students in my plone site.  They can now make and edit and review content...

(04:54:39 PM) dgroos: Anyone here have a not-too-difficult solution to batch-add about 350 new users to a plone site?
(04:55:04 PM) dgroos: I teach, don't code, sorry.
(04:55:30 PM) dgroos: Hi dahoste: I'm back for another try...
(04:57:45 PM) dahoste: dgroos, :) I did look over my stuff after we chatted, and I've factored it into like a dozen function calls and, and it's all pretty embedded into the custom policy product in which I'm using it. You'd be as well of (or better) starting from that tutorial blog post you mentioned as from anything I've got.
(04:58:57 PM) dgroos: dahoste: thanks for continued consideration on this need. :)
(05:02:31 PM) dgroos: Dahoste: Here's the page on the plone.org site: http://plone.org/documentation/kb/batch-adding-users.
(05:02:38 PM) Moo--__: dgroos: here is some more
(05:02:41 PM) dgroos: Would you take a quick gander and tell me if this is something that *should* be able to be adapted to plone 3.2?
(05:03:20 PM) Moo--__: https://svn.plone.org/svn/collective/collective.developermanual/trunk/source/members/member_basics.txt
(05:03:37 PM) Moo--__: dgroos: it works on plone 3.x
(05:03:40 PM) dgroos: If it looks doable I'll see if I can get some enthusiasm going :D
(05:03:48 PM) dgroos: Hi Moo--_: :)
(05:04:06 PM) dgroos: I'll check it out, thanks.
(05:07:03 PM) dahoste: dgroos, that script is literally the bare minimum for making a new user account. The regtool.addMember() call. But yes, that call looks fine. The devil in doing robust batch processing is all the stuff that script doesn't do. Checking against existing userids, sending account notifications, etc..
(05:08:08 PM) dahoste: dgroos, but it would technically do the job, if you have a known good set of user data, and you were pushing it into a known clean plone instance (or you otherwise felt confident that the userids wouldn't collide). And you didn't need account notifications.
(05:09:00 PM) dgroos: Thanks for checking it. It's an almost empty site and I can be careful about the info I put into the csv AND I don't need account notifications so...
(05:10:14 PM) dahoste: dgroos, then it sounds like a match made in heaven. :)
(05:10:24 PM) dgroos: Are you saying that it looks like it might work as is with a 3.2.x site? I'll make a new plone instance then and give it a try.
(05:10:27 PM) dgroos: :)
(05:11:09 PM) dahoste: dgroos, note that the little dictionary he uses to pass the other user properties in, can be extended with anything you see in portal_memberdata/Properties in the ZMI.
(05:12:00 PM) dahoste: dgroos, sure, the only Plone piece is really that regtool call. And that function signature likely hasn't changed.
(05:13:24 PM) dgroos: Are you saying that it might not be too hard for *someone-in-the-know* to make it so that it also adds people to a particular plone group?
(05:14:19 PM) dgroos: In the article that Moo--__: referenced, there is a section about adding users to a group...
(05:15:05 PM) dgroos: Thanks dahoste--I'll be giving this a try :D
(05:17:13 PM) dgroos: (getting out my note sheet...) Thanks!

(05:18:24 PM) dahoste: dgroos, have fun storming the castle. If it's a new plone instance, just wipe it and try again as you're vetting the script.
(05:19:11 PM) dgroos: Great, will do. I'll let you know next week or sooner how it goes.
(05:19:17 PM) dahoste: partial success of the batch will have created as many new users as it gets through, so you can't just re-run the batch without taking that into account (or wiping things first).

Now to get back to the irc and let them know and maybe get some help with the javascript error.

No comments:

Post a Comment