[Checkins] SVN: z3c.soap/trunk/ add SOAPAccess permission

Jean-Fran�ois Roche jfroche at jfroche.be
Fri Nov 14 10:37:11 EST 2008


Log message for revision 92927:
  add SOAPAccess permission

Changed:
  U   z3c.soap/trunk/buildout.cfg
  U   z3c.soap/trunk/setup.py
  U   z3c.soap/trunk/z3c/soap/README.txt
  U   z3c.soap/trunk/z3c/soap/__init__.py
  A   z3c.soap/trunk/z3c/soap/configure.zcml
  U   z3c.soap/trunk/z3c/soap/metaconfigure.py
  A   z3c.soap/trunk/z3c/soap/permissions.py
  U   z3c.soap/trunk/z3c/soap/tests/soap.zcml

-=-
Modified: z3c.soap/trunk/buildout.cfg
===================================================================
--- z3c.soap/trunk/buildout.cfg	2008-11-14 14:23:05 UTC (rev 92926)
+++ z3c.soap/trunk/buildout.cfg	2008-11-14 15:37:11 UTC (rev 92927)
@@ -31,6 +31,7 @@
     z3c.soap
 
 zcml =
+    z3c.soap
     z3c.soap-meta
 
 [test]

Modified: z3c.soap/trunk/setup.py
===================================================================
--- z3c.soap/trunk/setup.py	2008-11-14 14:23:05 UTC (rev 92926)
+++ z3c.soap/trunk/setup.py	2008-11-14 15:37:11 UTC (rev 92927)
@@ -29,6 +29,7 @@
       zip_safe=False,
       install_requires=[
           'setuptools',
+          'Products.CMFCore==2.1.1',
           'Products.PluggableAuthService==1.5.3',
           'ZSI'],
       entry_points="""

Modified: z3c.soap/trunk/z3c/soap/README.txt
===================================================================
--- z3c.soap/trunk/z3c/soap/README.txt	2008-11-14 14:23:05 UTC (rev 92926)
+++ z3c.soap/trunk/z3c/soap/README.txt	2008-11-14 15:37:11 UTC (rev 92927)
@@ -80,6 +80,7 @@
   ...
   ...   <include package="z3c.soap" file="meta.zcml" />
   ...   <include package="Products.Five" file="meta.zcml" />
+  ...   <include package="z3c.soap"/>
   ...
   ...   <soap:view
   ...       for="OFS.interfaces.IFolder"
@@ -87,7 +88,7 @@
   ...                echoFloat echoFloatArray echoStruct echoVoid echoBase64
   ...                echoDate echoDecimal echoBoolean ValidateEmailRequest"
   ...       class="z3c.soap.README.EchoView"
-  ...       permission="cmf.ManageProperties"
+  ...       permission="zope2.SOAPAccess"
   ...       />
   ...
   ...   <utility

Modified: z3c.soap/trunk/z3c/soap/__init__.py
===================================================================
--- z3c.soap/trunk/z3c/soap/__init__.py	2008-11-14 14:23:05 UTC (rev 92926)
+++ z3c.soap/trunk/z3c/soap/__init__.py	2008-11-14 15:37:11 UTC (rev 92927)
@@ -2,3 +2,4 @@
 # This is a Python package.
 import HTTPRequest
 from patch import *
+from permissions import *

Added: z3c.soap/trunk/z3c/soap/configure.zcml
===================================================================
--- z3c.soap/trunk/z3c/soap/configure.zcml	                        (rev 0)
+++ z3c.soap/trunk/z3c/soap/configure.zcml	2008-11-14 15:37:11 UTC (rev 92927)
@@ -0,0 +1,9 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+           i18n_domain="z3c.soap">
+
+  <permission
+      id="zope2.SOAPAccess"
+      title="SOAP Access"/>
+
+</configure>
+

Modified: z3c.soap/trunk/z3c/soap/metaconfigure.py
===================================================================
--- z3c.soap/trunk/z3c/soap/metaconfigure.py	2008-11-14 14:23:05 UTC (rev 92926)
+++ z3c.soap/trunk/z3c/soap/metaconfigure.py	2008-11-14 15:37:11 UTC (rev 92927)
@@ -18,8 +18,7 @@
 """
 
 from zope.interface import Interface
-from zope.security.checker import CheckerPublic #, Checker
-#from zope.location import Location
+from zope.security.checker import CheckerPublic
 from zope.component.interface import provideInterface
 from Products.Five.security import protectClass, protectName
 from zope.app.publisher.browser.viewmeta import _handle_for
@@ -64,19 +63,6 @@
     cdict = getSecurityInfo(class_)
 
     if name:
-        # Register a single view
-#        if permission:
-#            checker = Checker(require)
-#
-#            def proxyView(context, request, class_=class_, checker=checker):
-#                view = class_(context, request)
-#                # We need this in case the resource gets unwrapped and
-#                # needs to be rewrapped
-#                view.__Security_checker__ = checker
-#                return view
-#
-#            class_ = proxyView
-        cdict = getSecurityInfo(class_)
         cdict['__name__'] = name
         new_class = makeClass(class_.__name__,
                               (class_, BrowserView), cdict)
@@ -115,22 +101,13 @@
                 args = (new_class, attr, CheckerPrivateId))
 
     else:
-#        if permission:
-#            checker = Checker({'__call__': permission})
-#        else:
         for name in require:
-            # create a new callable class with a security checker; mix
-            # in zope.app.location.Location so that the view inherits
-            # a security context
             cdict.update({'__page_attribute__': name,
                           '__name__': name})
             new_class = makeClass(class_.__name__,
                                   (class_, ViewMixinForAttributes),
                                   cdict)
 
-            # in case the attribute does not provide a docstring,
-            # ZPublisher refuses to publish it.  So, as a workaround,
-            # we provide a stub docstring
             func = getattr(new_class, name)
             if not func.__doc__:
                 # cannot test for MethodType/UnboundMethod here

Added: z3c.soap/trunk/z3c/soap/permissions.py
===================================================================
--- z3c.soap/trunk/z3c/soap/permissions.py	                        (rev 0)
+++ z3c.soap/trunk/z3c/soap/permissions.py	2008-11-14 15:37:11 UTC (rev 92927)
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+"""
+z3c.soap
+
+Licensed under the GPL license, see LICENCE.txt for more details.
+Copyright by Affinitic sprl
+
+$Id$
+"""
+from AccessControl import ModuleSecurityInfo
+from Products.CMFCore.permissions import setDefaultRoles
+
+
+security = ModuleSecurityInfo('z3c.soap.permissions')
+
+security.declarePublic('SOAP Access')
+SoapAccess = 'SOAP Access'
+setDefaultRoles(SoapAccess, ('Authenticated', ))


Property changes on: z3c.soap/trunk/z3c/soap/permissions.py
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: z3c.soap/trunk/z3c/soap/tests/soap.zcml
===================================================================
--- z3c.soap/trunk/z3c/soap/tests/soap.zcml	2008-11-14 14:23:05 UTC (rev 92926)
+++ z3c.soap/trunk/z3c/soap/tests/soap.zcml	2008-11-14 15:37:11 UTC (rev 92927)
@@ -4,7 +4,7 @@
 
   <include package="z3c.soap" file="meta.zcml"/>
   <include package="zope.app.security" file="meta.zcml"/>
- 
+  <include package="z3c.soap" />
   <soap:view
       name="test"
       class="zope.app.component.tests.views.V1"



More information about the Checkins mailing list