[Zope-CMF] [dev] delete members: small proposal

Sam Brauer sam at webslingerz.com
Fri Sep 5 10:56:44 EDT 2003


I think it would also be good to have an API for the following operations:

- transfer ownership of all objects owned by a specific user to a new owner

- delete all objects owned by a specific user

- delete all local roles for a specific user


For the first two of these, the owned objects can be found with a simple 
catalog query on the Creator index.  For the third item, I think you 
have to recurse over the entire CMF site to check each object for local 
roles.


Perhaps the deleteMember method could be like this:

def deleteMember(member_id, delete_memberarea=1, new_owner_id=None, 
delete_all_owned_objects=1, delete_local_roles=1)

I think to avoid orphaned objects you would probably want to raise an 
exception if new_owner_id==None and delete_all_owned_objects==0

I've written some code (as an External Method) to do this stuff.  I'd be 
happy to share it if you're interested.


- Sam


Yuppie wrote:
> Hi!
> 
> 
> Currently there is no API to delete members. I propose to add these 
> methods:
> 
> 
> portal_membership:
> 
>     def deleteMember(member_id, delete_memberarea=1):
>         """ Delete member specified by member_id.
> 
>         Delete member in acl_users and member data in portal_memberdata.
>         If delete_memberarea is true, delete also member's home folder
>         including all content items.
> 
>         Permission -- Manage users
>         """
> 
>     def deleteMemberArea(member_id):
>         """ Delete member area of member specified by member_id.
> 
>         Permission -- Manage users
>         """
> 
> portal_memberdata:
> 
>     def deleteMemberData(member_id):
>         """ Delete member data of specified member.
> 
>         Permission -- Python only
>         """
> 
> 
> Any thoughts? If there are no objections or better ideas, I'll add these 
> methods in cvs head.
> 
> 
> Cheers,
>     Yuppie
> 
> 
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF at zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports and feature requests


-- 
Sam Brauer
Systems Programmer
sam at webslingerZ.com




More information about the Zope-CMF mailing list