Dumping userdata out of Zope

7 Messages Forum Options Options
Embed this topic
Permalink
Joel BJOERK MSc.
Dumping userdata out of Zope
Reply Threaded MoreMore options
Print post
Permalink
Hello,

I have a hundred odd users or so that I would like to dump in out of
Zope for inserting them in to a MySQL database. Does there exist a way
of dumping atleast the username password and emailaddress to a text
file? The xml file resulting from just exporting acl_users is not very
user-friendly and doesn't seem to contain the email addresses.

Regards,

Joel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
Andreas Jung
Re: Dumping userdata out of Zope
Reply Threaded MoreMore options
Print post
Permalink


--On 12. Januar 2006 18:59:11 +0100 "Joel BJOERK MSc."
<BJOERK@...> wrote:

> Hello,
>
> I have a hundred odd users or so that I would like to dump in out of
> Zope for inserting them in to a MySQL database. Does there exist a way
> of dumping atleast the username password and emailaddress to a text
> file? The xml file resulting from just exporting acl_users is not very
> user-friendly and doesn't seem to contain the email addresses.
>

Since user folders have a documented API you can easily write a small
script to output the users (which shouldn't be more than a three-liner
*wink*).
Usually you can not access the password since they are usually  stored as
hash from which you can not recover the password (depends on the Zope
version and user folder type).

-aj

attachment0 (193 bytes) Download Attachment
J Cameron Cooper-3
Re: Dumping userdata out of Zope
Reply Threaded MoreMore options
Print post
Permalink
Andreas Jung wrote:

>
>
> --On 12. Januar 2006 18:59:11 +0100 "Joel BJOERK MSc."
> <BJOERK@...> wrote:
>
>> Hello,
>>
>> I have a hundred odd users or so that I would like to dump in out of
>> Zope for inserting them in to a MySQL database. Does there exist a way
>> of dumping atleast the username password and emailaddress to a text
>> file? The xml file resulting from just exporting acl_users is not very
>> user-friendly and doesn't seem to contain the email addresses.
>>
>
> Since user folders have a documented API you can easily write a small
> script to output the users (which shouldn't be more than a three-liner
> *wink*).
> Usually you can not access the password since they are usually  stored
> as hash from which you can not recover the password (depends on the Zope
> version and user folder type).

A fair number of installs will have clear passwords. Last I checked this
was the default.

The install method of PlonePAS, by the way, has code for extracting and
reinserting members and all their information from an existing folder.
It doesn't write to disk, but you can modify the insertion code to do
whatever you want.

                --jcc
--
"Building Websites with Plone"
http://plonebook.packtpub.com/

Enfold Systems, LLC
http://www.enfoldsystems.com


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
Andreas Jung
Re: Dumping userdata out of Zope
Reply Threaded MoreMore options
Print post
Permalink


--On 12. Januar 2006 13:18:00 -0600 J Cameron Cooper
<jccooper@...> wrote:
>
> A fair number of installs will have clear passwords. Last I checked this
> was the default.

Possibly but encryption for the default Zope user folder is enabled since
Zope 2.8 by default.

-aj



attachment0 (193 bytes) Download Attachment
Raphael Ritz
Re: Dumping userdata out of Zope
Reply Threaded MoreMore options
Print post
Permalink
In reply to this post by Joel BJOERK MSc.
Joel BJOERK MSc. wrote:
> Hello,
>
> I have a hundred odd users or so that I would like to dump in out of
> Zope for inserting them in to a MySQL database. Does there exist a way
> of dumping atleast the username password and emailaddress to a text
> file? The xml file resulting from just exporting acl_users is not very
> user-friendly and doesn't seem to contain the email addresses.

This might give you some inspiration:

out = file('account_data.txt','w')
site = app[<your-site-id>]
mtool = site.portal_membership

for member in mtool.listMembers():
     id = member.getId()
     name = member.getProperty('fullname','')
     email = member.getProperty('email','')
     out.write("%s,%s,%s\n" % (id,name,email))
out.close()

Put this in a file (e.g., dumpMemberData.py) and call it
from INSTANCEHOME/bin like so:

zopectl run dumpMemberData.py

Note that you have to shut down your Zope before
unless you have a ZEO setting.


HTH,

    Raphael



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
michael nt milne
Re: Re: Dumping userdata out of Zope
Reply Threaded MoreMore options
Print post
Permalink
Interesting I guess that would work with CMFMember as well with a small amount of configuration.

On 1/12/06, Raphael Ritz <r.ritz@...> wrote:
Joel BJOERK MSc. wrote:
> Hello,
>
> I have a hundred odd users or so that I would like to dump in out of
> Zope for inserting them in to a MySQL database. Does there exist a way
> of dumping atleast the username password and emailaddress to a text
> file? The xml file resulting from just exporting acl_users is not very
> user-friendly and doesn't seem to contain the email addresses.

This might give you some inspiration:

out = file('account_data.txt','w')
site = app[<your-site-id>]
mtool = site.portal_membership

for member in mtool.listMembers():
     id = member.getId()
     name = member.getProperty('fullname','')
     email = member.getProperty ('email','')
     out.write("%s,%s,%s\n" % (id,name,email))
out.close()

Put this in a file (e.g., dumpMemberData.py) and call it
from INSTANCEHOME/bin like so:

zopectl run dumpMemberData.py

Note that you have to shut down your Zope before
unless you have a ZEO setting.


HTH,

    Raphael



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users

Raphael Ritz
Re: Dumping userdata out of Zope
Reply Threaded MoreMore options
Print post
Permalink
michael nt milne wrote:
> Interesting I guess that would work with CMFMember as well with a small
> amount of configuration.

If CMFMember doesn't break the member data API it should
work right away.

Raphael

>
> On 1/12/06, *Raphael Ritz* <
> r.ritz@...
> <mailto:r.ritz@...>> wrote:
>
>     Joel BJOERK MSc. wrote:
>      > Hello,
>      >
>      > I have a hundred odd users or so that I would like to dump in out of
>      > Zope for inserting them in to a MySQL database. Does there exist
>     a way
>      > of dumping atleast the username password and emailaddress to a text
>      > file? The xml file resulting from just exporting acl_users is not
>     very
>      > user-friendly and doesn't seem to contain the email addresses.
>
>     This might give you some inspiration:
>
>     out = file('account_data.txt','w')
>     site = app[<your-site-id>]
>     mtool = site.portal_membership
>
>     for member in mtool.listMembers():
>          id = member.getId()
>          name = member.getProperty('fullname','')
>          email = member.getProperty ('email','')
>          out.write("%s,%s,%s\n" % (id,name,email))
>     out.close()
>
>     Put this in a file (e.g., dumpMemberData.py) and call it
>     from INSTANCEHOME/bin like so:
>
>     zopectl run dumpMemberData.py
>
>     Note that you have to shut down your Zope before
>     unless you have a ZEO setting.
>
>
>     HTH,
>
>         Raphael
>
>
>
>     -------------------------------------------------------
>     This SF.net email is sponsored by: Splunk Inc. Do you grep through
>     log files
>     for problems?  Stop!  Download the new AJAX search engine that makes
>     searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>     http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>     <http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click>
>     _______________________________________________
>     Plone-Users mailing list
>     Plone-Users@...
>     <mailto:Plone-Users@...>
>     https://lists.sourceforge.net/lists/listinfo/plone-users
>
>



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users