From 1845be16f68cec3fea635032212259d8dac6de58 Mon Sep 17 00:00:00 2001 From: hvelarde Date: Thu, 5 May 2016 11:48:48 -0300 Subject: [PATCH 1/2] Document byline viewlet is now displayed only to anonymous users If permited by the Allow anyone to view 'about' information option in the Security Settings of Site Setup. Refs: https://github.com/plone/Products.CMFPlone/issues/1556 --- CHANGES.rst | 6 +++++- plone/app/layout/viewlets/content.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index da53f0e5..9efcc5b0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,7 +6,7 @@ Changelog Incompatibilities: -- Deprecated ``plone.app.layout.globals.pattern_settings``. +- Deprecated ``plone.app.layout.globals.pattern_settings``. Moved view to ``Products.CMFPlone.patterns.view``. Deprecated also pointless interface for this view. Addresses https://github.com/plone/Products.CMFPlone/issues/1513 and goes together with https://github.com/plone/Products.CMFPlone/issues/1514. @@ -18,6 +18,9 @@ New: Fixes: +- Document byline viewlet is now displayed only to anonymous users if permited by the `Allow anyone to view 'about' information` option in the `Security Settings` of `Site Setup` (closes `CMFPlone#1556`_). + [hvelarde] + - Fix body class ``pat-markspeciallinks`` not set. Fixes #84. [thet] @@ -1708,3 +1711,4 @@ Fixes: .. _`CMFPlone#1037`: https://github.com/plone/Products.CMFPlone/issues/1037 .. _`CMFPlone#1151`: https://github.com/plone/Products.CMFPlone/issues/1151 .. _`CMFPlone#1178`: https://github.com/plone/Products.CMFPlone/issues/1178 +.. _`CMFPlone#1556`: https://github.com/plone/Products.CMFPlone/issues/1556 diff --git a/plone/app/layout/viewlets/content.py b/plone/app/layout/viewlets/content.py index dabcb602..c4aebbeb 100644 --- a/plone/app/layout/viewlets/content.py +++ b/plone/app/layout/viewlets/content.py @@ -71,7 +71,7 @@ def show(self): ISecuritySchema, prefix='plone', ) - return not self.anonymous or settings.allow_anon_views_about + return self.anonymous and settings.allow_anon_views_about def show_history(self): has_access_preview_versions_permission = _checkPermission( From 7a603af3ef2d387e77507e3f1f1a11e447010658 Mon Sep 17 00:00:00 2001 From: hvelarde Date: Thu, 5 May 2016 12:00:12 -0300 Subject: [PATCH 2/2] Remove code used to show the lock status and history view in the document byline, as this information was not available to anonymous users anyway We need to review if this is available in the current implementation of the toolbar. --- CHANGES.rst | 1 + plone/app/layout/viewlets/content.py | 36 ------------------- plone/app/layout/viewlets/document_byline.pt | 14 -------- .../app/layout/viewlets/tests/test_content.py | 17 --------- 4 files changed, 1 insertion(+), 67 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 9efcc5b0..87f1418f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,6 +19,7 @@ New: Fixes: - Document byline viewlet is now displayed only to anonymous users if permited by the `Allow anyone to view 'about' information` option in the `Security Settings` of `Site Setup` (closes `CMFPlone#1556`_). + Code used to show the lock status and history view was removed from the document byline as this information was not available to anonymous users anyway. [hvelarde] - Fix body class ``pat-markspeciallinks`` not set. diff --git a/plone/app/layout/viewlets/content.py b/plone/app/layout/viewlets/content.py index c4aebbeb..9ce1fee6 100644 --- a/plone/app/layout/viewlets/content.py +++ b/plone/app/layout/viewlets/content.py @@ -73,42 +73,6 @@ def show(self): ) return self.anonymous and settings.allow_anon_views_about - def show_history(self): - has_access_preview_versions_permission = _checkPermission( - 'CMFEditions: Access previous versions', - self.context - ) - if not has_access_preview_versions_permission: - return False - if IViewView.providedBy(self.__parent__): - return True - if IFolderContentsView.providedBy(self.__parent__): - return True - return False - - def locked_icon(self): - if not getSecurityManager().checkPermission('Modify portal content', - self.context): - return "" - - locked = False - lock_info = queryMultiAdapter((self.context, self.request), - name='plone_lock_info') - if lock_info is not None: - locked = lock_info.is_locked() - else: - context = aq_inner(self.context) - lockable = getattr( - context.aq_explicit, 'wl_isLocked', None) is not None - locked = lockable and context.wl_isLocked() - - if not locked: - return "" - - portal = self.portal_state.portal() - icon = portal.restrictedTraverse('lock_icon.png') - return icon.tag(title='Locked') - def creator(self): return self.context.Creator() diff --git a/plone/app/layout/viewlets/document_byline.pt b/plone/app/layout/viewlets/document_byline.pt index c98e5e3a..24b9e32a 100644 --- a/plone/app/layout/viewlets/document_byline.pt +++ b/plone/app/layout/viewlets/document_byline.pt @@ -2,12 +2,6 @@ id="plone-document-byline" i18n:domain="plone" tal:condition="view/show"> - - - - expired - - — - History - -
' - ) - self.assertEqual(viewlet.locked_icon(), lockIconUrl) - def test_pub_date(self): # configure our portal to enable publication date on pages globally on # the site