[Zope-CMF] odd problem with user management
Jon Franz
jfranz@US.NET
Mon, 16 Jul 2001 20:12:16 -0400
Hello,
I'm using the CMF for my *gasp* corporate intranet, and due to
some policies=20
in place, employees cannot create thier own users. Instead, HR creates
the users and=20
defines all of thier properties. the employees can modify only one
property - the=20
about_me property, meanwhile all others should be editable by CMF
managers only.
I have created the needed forms and they pull the current user data, and
have created=20
the python code below and placed it inside CMFCore/Registration.py (I
know, put it in=20
CMFDefault, but I'm prototyping and dont care at this point), and the
code compiles=20
and runs without raising any errors. However, once run, the user's
folder disappears=20
from within the ZMI and the portal. =20
Any ideas of what I'm doing wrong?
Heres the code:
>>>>>>>>>
security.declareProtected(CMFCorePermissions.ManagePortal,
'setOthersProperties')
def setOthersProperties(self, user=3DNone, properties=3DNone, **kw):
'''Allows the authenticated member to set his/her own
properties.
Accepts either keyword arguments or a mapping for the
"properties"
argument.
'''
if user is None or user=3D=3D'':
raise 'Bad request', 'invalid user'
=20
if properties is None:
properties =3D kw
membership =3D getToolByName(self, 'portal_membership')
if not membership.isAnonymousUser():
member =3D membership.getMemberById(user)
failMessage =3D self.testPropertiesValidity(properties,
member)
if failMessage is not None:
raise 'Bad Request', failMessage
member.setMemberProperties(properties)
else:
raise 'Bad Request', 'Not logged in.'
<<<<<<<<<<<