a new howto
Guillaume GB <[email protected]> Mon, 4 May 2009 10:38:35 +0000 (GMT)
| Newsgroups | gmane.comp.web.zope.cps.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, sorry for the long time.
Here's my code in order to get a list of user id. I think there is no much chance this list can be too huge because I've apply the getMergedLocalRoles method on my particular object instead of the whole workspace. Ok, just look :
def getGuestIds( self ): # list of string
"return the id of each member guested (having the 'MyRoleGuest' role)"
mtool = getToolByName( self, 'portal_membership' )
user_with_roles_dict = mtool.getMergedLocalRoles( self )
# getMergedLocalRoles --> Products.CPSCore.CPSMembershipTool.CPSMembershipTool
# return a dictionary formed as {'user:john':['Owner', ], }
guest_list = [ keyuser.split( ':' )[1] for keyuser in user_with_roles_dict
if "MyRoleGuest" in user_with_roles_dict[keyuser] ]
So, I hope this is a good code.
Hum... now, I've something else to do but no idea on how. First, I would like to detect when a user exit the view page of my object. And then, if it's possible, detect if a user is "inactive" for a time.
That's all (just now :-)). I hope my english is understandable.
cheers,
Guillaume GB.
_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel