[Zope3-checkins] SVN: Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/pd_permissionchange_view.py View coping with process definition permissions update

Julien Anguenot ja at nuxeo.com
Wed Oct 13 16:58:58 EDT 2004


Log message for revision 28130:
  View coping with process definition permissions update

Changed:
  A   Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/pd_permissionchange_view.py

-=-
Added: Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/pd_permissionchange_view.py
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/pd_permissionchange_view.py	2004-10-13 20:58:27 UTC (rev 28129)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/pd_permissionchange_view.py	2004-10-13 20:58:56 UTC (rev 28130)
@@ -0,0 +1,73 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+"""Permission change view
+
+Use when updating the permissions on the process definition.
+
+$Id:$
+"""
+
+from zope.app import zapi
+from zope.event import notify
+
+from zope.app.workflow.stateful.pd_events import \
+     ProcessDefinitionAddPermissionsEvent, ProcessDefinitionDelPermissionsEvent
+
+class PermissionChangeView:
+    """Permission Change view
+
+    The permissions are changed on the process definition
+    We send a ProcessDefinitionPermissionsChangedEvent
+    """
+
+    def __init__(self, context, request):
+        """Constructor
+        """
+        self.context=context
+        self.request=request
+
+    def sendProcessDefinitionAddPermissionsEvent(self,
+                                                 permissions_to_add):
+        """Add a permission
+        """
+
+        event = ProcessDefinitionAddPermissionsEvent(self.context,
+                                                     permissions_to_add)
+        notify(event)
+
+        #
+        # Redirect on the context default view
+        # Maybe we would like to define the redirection somewhere
+        #
+
+        redirect_url = zapi.getView(self.context, 'absolute_url', self.request)
+        self.request.response.redirect(redirect_url)
+
+    def sendProcessDefinitionDelPermissionsEvent(self,
+                                                 permissions_to_remove):
+        """Del a permission
+        """
+
+        event = ProcessDefinitionDelPermissionsEvent(self.context,
+                                                     permissions_to_remove)
+        notify(event)
+
+        #
+        # Redirect on the context default view
+        # Maybe we would like to define the redirection somewhere
+        #
+
+        redirect_url = zapi.getView(self.context, 'absolute_url', self.request)
+        self.request.response.redirect(redirect_url)



More information about the Zope3-Checkins mailing list