[Zope-PTK] Using LoginManager
Fabio Forno
sciasbat@inorbit.com
Wed, 09 Aug 2000 16:18:10 -0400
ralf.herold@charite.de wrote:
>
> I would appreciat if you could send me your solution in detail, as there are
> similar problems here. Thanks in advance,
>
In the products management tab enter into the MembershipZ product. Now
enter into the LoginManager ZClass and add a Python Method called
toolbox_actions which takes as parameters self and url=0. This method
overrides the original one in the
Mebership.PersistentUserSource.MemberMixin class, one of the bases of
LoginMember
Then into the body paste this code, which has been taken from
PTKBase/MolderFolder.py:
---begin code---
"""Implements the Toolbox Action Provider interface"""
actions = []
homeUrl = self.getHomeUrl()
if homeUrl is not None:
actions.append(
{'name': 'My Stuff',
'url': homeUrl + '/portal_contents',
'permissions': [],
'category': 'user'},
)
if self.has_role('Reviewer'):
# Won't see local role. :-/
# The 'if' is there to prevent a query per request for people who
# won't see the result anyway.
pending = len(self.getPortal().getCatalog().searchResults(
review_state='pending'))
#import pdb; pdb.set_trace()
if pending:
actions.append(
{'name': 'Pending review (%d)' % pending,
'url': self.getPortal().absolute_url() +
'/search?review_state=pending',
'permissions': ['Review portal content'],
'category': 'global'}
)
return actions
---end code---
Now all should work fine.
ByE,
Fabio Forno