Rev | Line | |
---|
[14] | 1 | ## Script (Python) "selectMenus" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters=type_name=None |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | pm = context.portal_membership |
---|
| 11 | member = pm.getAuthenticatedMember() |
---|
| 12 | |
---|
| 13 | menus = context.portal_catalog(portal_type=('Menu', 'TaskMenu')) |
---|
| 14 | isAdmin = member is not None and member.has_role(('Manager', 'Staff',)) |
---|
| 15 | if not isAdmin: |
---|
| 16 | menus = [ m for m in menus if not 'admin' in m.getId ] |
---|
| 17 | return [ m.getObject() for m in menus ] |
---|
Note: See
TracBrowser for help on using the repository browser.