From 8b5df16afc6412b6d928cc06fddfaf838d574308 Mon Sep 17 00:00:00 2001 From: helmutm Date: Thu, 15 May 2008 13:39:16 +0000 Subject: [PATCH] show object actions only for logged-in users git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2596 fd906abe-77d9-0310-91a1-e0d9ade77398 --- browser/common.py | 7 ++++++- browser/concept_macros.pt | 6 ++++-- browser/resource_macros.pt | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/browser/common.py b/browser/common.py index f2d93be..d6a9141 100644 --- a/browser/common.py +++ b/browser/common.py @@ -28,6 +28,7 @@ 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.pagetemplate import ViewPageTemplateFile +from zope.app.security.interfaces import IUnauthenticatedPrincipal from zope.app.security.interfaces import PrincipalLookupError from zope.cachedescriptors.property import Lazy from zope.dottedname.resolve import resolve @@ -400,7 +401,7 @@ class BaseView(GenericView, I18NView): result.append(stf) return result - # controlling editing + # controlling actions and editing @Lazy def editable(self): @@ -415,6 +416,10 @@ class BaseView(GenericView, I18NView): actions.extend(self.actions[category](self, page=page, target=target)) return actions + @Lazy + def showObjectActions(self): + return not IUnauthenticatedPrincipal.providedBy(self.request.principal) + def openEditWindow(self, viewName='edit.html'): if self.editable: if checkPermission('loops.ManageSite', self.context): diff --git a/browser/concept_macros.pt b/browser/concept_macros.pt index 11d799e..0ca0c19 100644 --- a/browser/concept_macros.pt +++ b/browser/concept_macros.pt @@ -114,7 +114,8 @@ Size Modification Date Author(s) - Info + Info John + style nothing" + tal:condition="view/showObjectActions">
diff --git a/browser/resource_macros.pt b/browser/resource_macros.pt index e31540a..fe1cdf2 100644 --- a/browser/resource_macros.pt +++ b/browser/resource_macros.pt @@ -2,7 +2,9 @@
-
+ +
+

Title