provide log-in portlet
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3910 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
f783895538
commit
00ae2f6a99
6 changed files with 38 additions and 8 deletions
|
@ -28,7 +28,7 @@ from urllib import urlencode
|
|||
from zope import component
|
||||
from zope.app.form.browser.interfaces import ITerms
|
||||
from zope.app.i18n.interfaces import ITranslationDomain
|
||||
from zope.app.security.interfaces import IAuthentication
|
||||
from zope.app.security.interfaces import IAuthentication, IUnauthenticatedPrincipal
|
||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||
from zope.app.security.interfaces import IUnauthenticatedPrincipal
|
||||
from zope.app.security.interfaces import PrincipalLookupError
|
||||
|
@ -150,6 +150,10 @@ class BaseView(GenericView, I18NView):
|
|||
principal = self.request.principal
|
||||
return principal and principal.id or ''
|
||||
|
||||
@Lazy
|
||||
def isAnonymous(self):
|
||||
return IUnauthenticatedPrincipal.providedBy(self.request.principal)
|
||||
|
||||
def recordAccess(self, viewName, **kw):
|
||||
access.record(self.request, principal=self.principalId, view=viewName, **kw)
|
||||
|
||||
|
|
|
@ -117,10 +117,19 @@ class NodeView(BaseView):
|
|||
# TODO: is this useful in any case?
|
||||
self.virtualTargetObject is not None and
|
||||
canWrite(self.virtualTargetObject, 'title')):
|
||||
cm.register('portlet_right', 'actions', title=_(u'Actions'),
|
||||
subMacro=node_macros.macros['actions'],
|
||||
priority=100)
|
||||
if not IUnauthenticatedPrincipal.providedBy(self.request.principal):
|
||||
# check if there are any available actions;
|
||||
# store list of actions in macro object (evaluate only once)
|
||||
actions = [act for act in self.getActions('portlet') if act.condition]
|
||||
if actions:
|
||||
cm.register('portlet_right', 'actions', title=_(u'Actions'),
|
||||
subMacro=node_macros.macros['actions'],
|
||||
priority=100, actions=actions)
|
||||
if self.isAnonymous and self.globalOptions('provideLogin'):
|
||||
cm.register('portlet_right', 'login', title=_(u'Not logged in'),
|
||||
subMacro=node_macros.macros['login'],
|
||||
icon='cybertools.icons/user.png',
|
||||
priority=10)
|
||||
if not self.isAnonymous:
|
||||
mi = self.controller.memberInfo
|
||||
title = mi.title.value or _(u'Personal Informations')
|
||||
url=None
|
||||
|
|
|
@ -221,14 +221,21 @@
|
|||
|
||||
|
||||
<metal:actions define-macro="actions">
|
||||
<tal:actions repeat="action python:view.getActions('portlet')">
|
||||
<tal:actions repeat="action macro/actions">
|
||||
<metal:action use-macro="action/macro" />
|
||||
</tal:actions>
|
||||
</metal:actions>
|
||||
|
||||
|
||||
<metal:login define-macro="login">
|
||||
<div><a href="login.html"
|
||||
i18n:translate="">Log in</a></div>
|
||||
</metal:login>
|
||||
|
||||
|
||||
<metal:actions define-macro="personal">
|
||||
<div><a href="logout.html?nextURL=login.html"
|
||||
tal:attributes="href string:logout.html?nextURL=${view/menu/url}"
|
||||
i18n:translate="">Log out</a></div>
|
||||
<tal:actions repeat="action python:view.getActions('personal')">
|
||||
<metal:action use-macro="action/macro" />
|
||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
|||
|
||||
"Project-Id-Version: $Id$\n"
|
||||
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
||||
"PO-Revision-Date: 2010-02-20 12:00 CET\n"
|
||||
"PO-Revision-Date: 2010-06-27 12:00 CET\n"
|
||||
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -197,6 +197,15 @@ msgstr "Lesezeichen für aktuelles Objekt hinzufügen"
|
|||
msgid "Remove from favorites"
|
||||
msgstr "Lesezeichen entfernen"
|
||||
|
||||
msgid "Personal Informations"
|
||||
msgstr "Persönliche Informationen"
|
||||
|
||||
msgid "Not logged in"
|
||||
msgstr "Nicht angemeldet"
|
||||
|
||||
msgid "Log in"
|
||||
msgstr "Anmelden"
|
||||
|
||||
msgid "Presence"
|
||||
msgstr "Anwesenheit"
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ allRolesExceptOwner = (
|
|||
allRolesExceptOwnerAndMaster = tuple(allRolesExceptOwner[:-1])
|
||||
minorPrivilegedRoles = ('zope.Anonymous', 'zope.Member',)
|
||||
localRoles = ('zope.Anonymous', 'zope.Member', 'zope.ContentManager',
|
||||
'loops.Staff', 'loops.Member', 'loops.Master', 'loops.Owner')
|
||||
'loops.SiteManager', 'loops.Staff', 'loops.Member', 'loops.Master',
|
||||
'loops.Owner')
|
||||
|
||||
localPermissions = ('zope.ManageContent', 'zope.View', 'loops.ManageWorkspaces',
|
||||
'loops.ViewRestricted', 'loops.EditRestricted', 'loops.AssignAsParent',)
|
||||
|
|
Loading…
Add table
Reference in a new issue