Skip to content

mxm, IT's mad science

Sections
Personal tools
You are here: Home » Products » Open Source » mxm Workgroups for Plone » portal_actions Condition
Downloads
You can download mxm products here.

Due to it's technical and international nature, this section is in english.

Max M Has a blog too.

og er glad for mad

 

Comment

Above in this comment thread: mxm Workgroups for Plone » Workgroup folder as portal tab » You should look in the workgroup_tool

portal_actions Condition

Posted by Anonymous User at 2004-05-21 10:09 AM
I tried using that as condition, but the site complains it doesn't know mxm_workgroups. Is there something I should declare when using the Condition field of a portal_action?
thanks for your time,
Alf

Got it working

Posted by Anonymous User at 2005-03-03 01:19 PM
I wanted to do this as well, and have managed to get it to work after a bit of experimenting. I'm very new to both Plone and Python so I'm sure that some of this is not the best way of doing it, but it works.

1) We need to make a new version of getMembersOfGroup from mxmWorkgroupTool.py (line 242). The current one takes an object rather than a string path for the group we want, we can't get a group because if the user does not belong to the group we get an Insufficient Privileges exception thrown (comment -> maybe we could just catch the exception and return false?). I have called my new version getMemberofGroupString it is identical to the original apart from it doesn't call _o2path as we've already got the path. Paste this into the mxmWorkgroupTool.py file immediately below the end of the getMembersOfGroup method

security.declarePublic('getMembersOfGroupString')
def getMembersOfGroupString(self, group):
"Returns the accessible members of a group"
portal_membership = getToolByName(self, 'portal_membership')
member_ids = self._get(group)
groupmembers = self._ids2members(member_ids)
return groupmembers

2) Set up the condition on the tab
python:member in portal.mxm_workgroups.getMembersOfGroupString('<path to your group>')

for example
python:member in portal.mxm_workgroups.getMembersOfGroupString('/Plone/sales')

It works for me, hopefully will for anyone else.

Thanks for an excellent product.

Dave Sykes

RE: portal_actions Condition

Posted by Anonymous User at 2008-12-03 05:41 PM
I'm attempting to do this as well and am not having much luck. I'm using the following condition currently which at least doesn't throw any errors but it also doesn't make the tab visible to the correct group.

python:member and (member.id in here.portal_workgrouptool.getGroupMembers('GroupNameHere'))

Can you point me in the correct direction?

Thanks,
-Doug