Commits

Kai Diefenbach committed 6c2d0af

Added update all permissions utility.

Comments (0)

Files changed (3)

lfc/manage/urls.py

     url(r'^add-state/(?P<id>\d+)$', "add_workflow_state", name="lfc_manage_add_workflow_state"),
     url(r'^add-transition/(?P<id>\d+)$', "add_workflow_transition", name="lfc_manage_add_workflow_transition"),
     url(r'^delete-transition/(?P<id>\d+)$', "delete_workflow_transition", name="lfc_manage_delete_workflow_transition"),
-    
     url(r'^save-transition/(?P<id>\d+)$', "save_workflow_transition", name="lfc_manage_save_workflow_transition"),
+    url(r'^update-all-permissions$', "update_all_permissions", name="lfc_manage_update_all_permissions"),
 
+    # Portal
     url(r'^save-portal-core$', "portal_core", name="lfc_save_portal_core"),
 
     # portlets

lfc/manage/views.py

 from lfc.utils.registration import get_allowed_subtypes
 from lfc.utils.registration import get_info
 
+
 # Global #####################################################################
 ##############################################################################
 
 
     return HttpResponse(result)
 
+
 # Portlets ###################################################################
 ##############################################################################
 
     return MessageHttpResponseRedirect(
         reverse("lfc_manage_workflow"), _(u"Workflow has been deleted."))
 
+def update_all_permissions(request):
+    """Updates the permissions of all objects to their current workflow state
+    """
+    get_portal().check_permission(request.user, "manage_portal")
+    for obj in lfc.utils.get_content_objects():
+        workflows.utils.update_permissions(obj)
+    return MessageHttpResponseRedirect(reverse("lfc_manage_utils"), _(u"Permissions have been updated."))
+
 # Workflow state #############################################################
 ##############################################################################
 

lfc/templates/lfc/manage/utils.html

                             {% trans "Reindex Objects" %}
                         </a>
                     </li>
+                    <li>
+                        <a href="{% url lfc_manage_update_all_permissions %}">
+                            {% trans "Update Permissions" %}
+                        </a>
+                    </li>
                 </ul>
             </div>
         </div>