add role to user (using API)
Hello list, --- I'm trying to use the MembershipTool to append a role to one of my users, using the setLocalRoles API-function. How does this function work? I want to upgrade a user from plain 'Member' to a new role, in a form script. Ideas are appreciated. \malthe ---- mail: mborch@3avod.dk blog: www.3avod.dk/blog/ crypto-key: 3avod.dk/keys/mborch.asc --------------------------------------
On Mar 27, 2005, at 22:57, Malthe Borch wrote:
Hello list, ---
I'm trying to use the MembershipTool to append a role to one of my users, using the setLocalRoles API-function. How does this function work?
I want to upgrade a user from plain 'Member' to a new role, in a form script.
Are you confusing global roles as stored on a user/member with local roles, as stored on an object in the ZODB? The API document isn't too confusing, I think: def setLocalRoles(obj, member_ids, member_role, reindex=1): """ Add local roles on an item. Permission -- Always available """ You pass in the object (folder, content object, etc) you want to set local roles on, a sequence of member IDs, and the role name. jens
Jens Vagelpohl wrote:
def setLocalRoles(obj, member_ids, member_role, reindex=1): """ Add local roles on an item.
Permission -- Always available """
You pass in the object (folder, content object, etc) you want to set local roles on, a sequence of member IDs, and the role name.
Maybe it should be made clear that the role needs to exist, and that setLocalRoles doesn't check that this is the case? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (3)
-
Chris Withers -
Jens Vagelpohl -
Malthe Borch