[Zope-CMF] Membership by approval - question

Chris Withers chrisw@nipltd.com
Wed, 26 Feb 2003 09:30:55 +0000


Rob Boyd wrote:
> Has anyone implemented membership-by-review, that is,
> visitors don't create their own membership, but
> rather, prospective members apply and their
> application goes into a workflow for managers to
> review?  

No, but I've been thinking about it recently ;-)

> I've been mulling about the design of this,
> and my thoughts have been either: A)create a new type,
> like 'JoinRequest', and create a workflow for it, or
> B)subclass CMFCollector, have member applications
> basically be a request put into the collector, and
> tailor my workflow for it.

How about having a 'Member' content type?
(It would have a roles property and a password property, you could do 
this by basing the content on Document and using a 
ScriptableTypeInformation object and having the creation script add a 
'lines' property for roles and a 'string' property for password. You'd 
also need to create a skin template and methd for editing these user 
objects)
The workflow for this type could have "pending" and "approved" states 
(you might even be able to use the default workflow ;-)

Now, how do you actually make Zope use these content types as users?

...this is why I've been thinking about it!

SimpleUserFolder lets you do this really easily. Replace the normal user 
folder with a SUF, and implement getUserDetails as a Script(Python) 
something like:

# parameters: name

# Your skin should also prevent more than one user with the
# same id being created ;-)
users = context.portal_catalog(portal_type="user",id=name)
if not users:
   return None
user = users[0].getObject()
return {
   'password':user.password,
   'roles':   user.roles,
   }

Please give this a go, I'll help if you get stuck and I'll be well 
chuffed when you get it up and running :-)

cheers,

Chris