came_from = req.form.get('came_from')
if came_from :
- urlQs = came_from.split('?', 1)
- if len(urlQs) == 1 :
- came_from = '%s?%s' % (urlQs[0], mq(portal_status_message=_('Login success')))
- else :
- url, qs= urlQs
- came_from = '%s?%s&%s' % (url, qs, mq(portal_status_message=_('Login success')))
- return resp.redirect(came_from)
+ urlQs = came_from.split('?', 1)
+ if len(urlQs) == 1 :
+ came_from = '%s?%s' % (urlQs[0], mq(portal_status_message=_('Login success')))
+ else :
+ url, qs= urlQs
+ came_from = '%s?%s&%s' % (url, qs, mq(portal_status_message=_('Login success')))
+ return resp.redirect(came_from)
-return resp.redirect('%s?%s' % (utool(), mq(portal_status_message=_('Login success'))))
\ No newline at end of file
+else :
+ from Products.Plinn.utils import searchContentsWithLocalRolesForAuthenticatedUser as search
+ results = search(portal_type='Portfolio')
+ if results :
+ atool = getToolByName(context, 'portal_actions')
+ return context.setRedirect(atool, 'user/my_albums', portal_status_message=_('Login success'))
+ else :
+ utool = getToolByName(context, 'portal_url')
+ return resp.redirect('%s?%s' % (utool(), mq(portal_status_message=_('Login success'))))
+
\ No newline at end of file
##parameters=
-from Products.realis.utils import searchContentsWithLocalRolesForAuthenticatedUser as search
+from Products.Plinn.utils import searchContentsWithLocalRolesForAuthenticatedUser as search
-results = search(context, portal_type='Portfolio')
+results = search(portal_type='Portfolio')
return context.member_albums_template(results = results)
\ No newline at end of file
raise e
return ret
-
\ No newline at end of file
+
+security.declarePublic('searchContentsWithLocalRolesForAuthenticatedUser')
+def searchContentsWithLocalRolesForAuthenticatedUser(**kw):
+ mtool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
+ ctool = getUtilityByInterfaceName('Products.CMFCore.interfaces.ICatalogTool')
+ member = mtool.getAuthenticatedMember()
+ userid = member.getId()
+ userAndGroups = ['user:%s' % userid]
+
+ getGroups = getattr(member, 'getGroups', None)
+ if getGroups is not None :
+ for group in getGroups():
+ userAndGroups.append('user:'+group)
+
+ kw[ 'allowedRolesAndUsers' ] = userAndGroups
+
+ return ctool.unrestrictedSearchResults(**kw)