Prise en charge des permissions dans l'affichage / masquage de la barre d'outils.
authorBenoît Pin <benoit.pin@gmail.com>
Sun, 6 Jul 2014 05:42:01 +0000 (07:42 +0200)
committerBenoît Pin <benoit.pin@gmail.com>
Sun, 6 Jul 2014 05:42:01 +0000 (07:42 +0200)
skins/getPhotoInfo.py
skins/getPhotosInfos.py
skins/photo_layout_macros.pt
skins/portfolio_view.pt

index 2947778..bb4391d 100755 (executable)
@@ -1,6 +1,6 @@
 ##parameters=
 from Products.CMFCore.utils import getToolByName
 ##parameters=
 from Products.CMFCore.utils import getToolByName
-from Products.CMFCore.permissions import ReviewPortalContent
+from Products.CMFCore.permissions import ReviewPortalContent, ModifyPortalContent
 mtool = getToolByName(context, 'portal_membership')
 pptool = getToolByName(context, 'portal_photo_print', None)
 uidtool = getToolByName(context, 'portal_uidhandler')
 mtool = getToolByName(context, 'portal_membership')
 pptool = getToolByName(context, 'portal_photo_print', None)
 uidtool = getToolByName(context, 'portal_uidhandler')
@@ -17,6 +17,9 @@ features['cart'] = lambda o : '%s/get_slide_buyable_items' % o.absolute_url()
 
 if mtool.checkPermission(ReviewPortalContent, context) :
     features['hideAnonymous'] = True
 
 if mtool.checkPermission(ReviewPortalContent, context) :
     features['hideAnonymous'] = True
+if mtool.checkPermission(ModifyPortalContent, context) :
+    features['checkbox'] = True
+
 
 sd = context.session_data_manager.getSessionData(create = 1)
 selDict = sd.get('objects_selection_dict', {})
 
 sd = context.session_data_manager.getSessionData(create = 1)
 selDict = sd.get('objects_selection_dict', {})
index 1679c40..2d42635 100755 (executable)
@@ -1,7 +1,7 @@
 ##parameters=portfolio
 from Products.Plinn.PloneMisc import Batch
 from Products.CMFCore.utils import getToolByName
 ##parameters=portfolio
 from Products.Plinn.PloneMisc import Batch
 from Products.CMFCore.utils import getToolByName
-from Products.CMFCore.permissions import ReviewPortalContent
+from Products.CMFCore.permissions import ReviewPortalContent, ModifyPortalContent
 mtool = getToolByName(context, 'portal_membership')
 pptool = getToolByName(context, 'portal_photo_print', None)
 uidtool = getToolByName(context, 'portal_uidhandler')
 mtool = getToolByName(context, 'portal_membership')
 pptool = getToolByName(context, 'portal_photo_print', None)
 uidtool = getToolByName(context, 'portal_uidhandler')
@@ -18,6 +18,8 @@ features['cart'] = lambda o : '%s/get_slide_buyable_items' % o.absolute_url()
 
 if mtool.checkPermission(ReviewPortalContent, context) :
     features['hideAnonymous'] = True
 
 if mtool.checkPermission(ReviewPortalContent, context) :
     features['hideAnonymous'] = True
+if mtool.checkPermission(ModifyPortalContent, context) :
+    features['checkbox'] = True
 
 req = context.REQUEST
 pho_start = req.get('pho_start', 0)
 
 req = context.REQUEST
 pho_start = req.get('pho_start', 0)
index 1ca17fa..f6003ba 100644 (file)
@@ -66,7 +66,7 @@
                      i18n:attributes="alt"/>
               </a>
             </span>
                      i18n:attributes="alt"/>
               </a>
             </span>
-            <span class="button cb">
+            <span class="button cb" tal:condition="features/checkbox|nothing">
               <input type="checkbox" name="uids:list"
                      tal:attributes="value info/cmf_uid"/>
             </span>
               <input type="checkbox" name="uids:list"
                      tal:attributes="value info/cmf_uid"/>
             </span>
index 5535fa8..96a5882 100644 (file)
@@ -67,7 +67,9 @@
                      features batchInfos/features"
          tal:omit-tag="">
       <form tal:attributes="action string:${here/absolute_url}/portfolio_edit_form" method="post">
                      features batchInfos/features"
          tal:omit-tag="">
       <form tal:attributes="action string:${here/absolute_url}/portfolio_edit_form" method="post">
-        <div id="image_toolbar" class="image_toolbar">
+        <div id="image_toolbar" class="image_toolbar"
+             tal:define="ModifyPortalContent modules/Products/CMFCore/permissions/ModifyPortalContent"
+             tal:condition="python:mtool.checkPermission(ModifyPortalContent, here)">
           <input type="image" width="17" height="27" alt="delete" title="delete"
                  name="delete"
                  tal:attributes="src string:$portal_url/trash_btn.gif"
           <input type="image" width="17" height="27" alt="delete" title="delete"
                  name="delete"
                  tal:attributes="src string:$portal_url/trash_btn.gif"