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
This commit is contained in:
parent
c98f77ac46
commit
8b5df16afc
3 changed files with 13 additions and 4 deletions
|
@ -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):
|
||||
|
|
|
@ -114,7 +114,8 @@
|
|||
<th i18n:translate="">Size</th>
|
||||
<th i18n:translate="">Modification Date</th>
|
||||
<th i18n:translate="">Author(s)</th>
|
||||
<th i18n:translate="">Info</th>
|
||||
<th i18n:translate=""
|
||||
tal:condition="view/showObjectActions">Info</th>
|
||||
</tr>
|
||||
<tal:items repeat="related resources">
|
||||
<tal:item define="class python: repeat['related'].odd() and 'even' or 'odd';
|
||||
|
@ -144,7 +145,8 @@
|
|||
<td><span tal:replace="related/creators">John</span></td>
|
||||
<td style="white-space: nowrap"
|
||||
tal:define="target nocall:related;
|
||||
style nothing">
|
||||
style nothing"
|
||||
tal:condition="view/showObjectActions">
|
||||
<div metal:use-macro="views/node_macros/object_actions" />
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
<div tal:attributes="ondblclick python: item.openEditWindow('configure.html')">
|
||||
<tal:body define="itemNum view/itemNum;
|
||||
id string:$itemNum.body;">
|
||||
<div metal:use-macro="views/node_macros/object_actions" />
|
||||
<tal:actions condition="view/showObjectActions">
|
||||
<div metal:use-macro="views/node_macros/object_actions" />
|
||||
</tal:actions>
|
||||
<h1 tal:content="item/title">Title</h1>
|
||||
<p tal:define="description description|item/description"
|
||||
tal:condition="description">
|
||||
|
|
Loading…
Add table
Reference in a new issue