On May 4, 2009, at 12:38 PM, Guillaume GB wrote:

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.

It should work, but you don't treat the case of groups having this local role, e.g 'group:some_group': ['Owner', 'MyRoleGuest'] in the dict.

The use of groups in various local roles assignments is encouraged in the general case because it's usually less prone to modifications (which can be costly, especially for folder hierarchies).


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.

That's almost impossible - and breaks things like tab navigation, which CPS supports very well (a strong point for ease of use compared to most apps heavily based on session persistence)

And then, if it's possible, detect if a user is "inactive" for a time.

We don't have that currently, either.

Cheers,



That's all (just now :-)). I hope my english is understandable.

Can't say, I'm french, too :-)




cheers,
Guillaume GB.


_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

--
Georges Racinet, http://www.racinet.fr
Zope/CPS/Plone expertise, assistance & development
GPG: 0x4862FFF7







_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to