[Zope-CMF] Allow Manager to edit properties of other users

Kevin Carlson khcarlso@bellsouth.net
Sun, 1 Dec 2002 18:00:46 -0500


You'll have to do this in an external method.  Also, you might want to take
advantage of the _changeUser method in acl_users in that external method's
code.  I am doing both of these and it works fine.  Here is the script I am
using:

-------------------------------------------
from Products.CMFCore import utils
from AccessControl import User

def edituserhandler(ns, username, request) :
    pm = utils.getToolByName(ns, 'portal_membership')
    member = pm.getMemberById(username)
    member.setMemberProperties(request)
    password = request.get('password')
    confirm = request.get('confirm')
    roles = request.get('role')
    domains = request.get('domains')
    md = ns.acl_users._changeUser(username, password, confirm, roles,
domains, request)
    return md

--------------------------------------------

Hope this helps,

Kevin

-----Original Message-----
From: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]On Behalf
Of Tom Cameron
Sent: Sunday, December 01, 2002 6:35 AM
To: zope-cmf@zope.org
Subject: [Zope-CMF] Allow Manager to edit properties of other users


I am building a CMF site using skins. I am using the memberdata tool to
store lots of properties about members.

I want the Manager of the site to be able to modify other users properties
but when I try to call the setMemberProperties() it does not work because
that method is declared Private.

This is the script I wrote, I pass the memberid in the request along with
all the new property values....

---
REQUEST=context.REQUEST
memberid = REQUEST['memberid']
member = context.portal_membership.getMemberById(memberid)

failMessage = context.portal_registration.testPropertiesValidity(REQUEST,
member)

if failMessage:
    REQUEST.set('portal_status_message', failMessage)
    return context.member_edit(context, REQUEST)

member.setMemberProperties(REQUEST)
REQUEST.set('portal_status_message', 'details updated')
return context.member_edit(context, REQUEST)
---

So, how do I allow the Manager to edit another member's properties? I dont
want to have to hack the CMF code itself and I was hoping to keep all my
code in the skins for ease.

Thanks
Tom



_______________________________________________
Zope-CMF maillist  -  Zope-CMF@zope.org
http://lists.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests