[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/publisher/xmlrpc/
Addressed issue 469 by requiring the permission attribute.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Nov 16 16:56:51 EST 2005
Log message for revision 40181:
Addressed issue 469 by requiring the permission attribute.
Changed:
U Zope3/trunk/src/zope/app/publisher/xmlrpc/metadirectives.py
U Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/test_directives.py
U Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml
U Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml
A Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcml
-=-
Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/metadirectives.py 2005-11-16 21:36:41 UTC (rev 40180)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/metadirectives.py 2005-11-16 21:56:51 UTC (rev 40181)
@@ -23,7 +23,7 @@
class IViewDirective(zope.interface.Interface):
"""View Directive for XML-RPC methods."""
-
+
for_ = zope.configuration.fields.GlobalObject(
title=u"Published Object Type",
description=u"""The types of objects to be published via XML-RPC
@@ -68,12 +68,12 @@
If no permission is given, then permissions should be declared
for the view using other means, such as the class directive.
""",
- required=False, )
+ required=True)
name = zope.schema.TextLine(
title=u"The name of the view.",
description=u"""
-
+
If a name is given, then rpc methods are accessed by
traversing the name and then accessing the methods. In this
case, the class should implement
Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/test_directives.py 2005-11-16 21:36:41 UTC (rev 40180)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/test_directives.py 2005-11-16 21:56:51 UTC (rev 40181)
@@ -75,10 +75,14 @@
self.assertEqual(v.index(), 'V1 here')
self.assertEqual(v.action(), 'done')
- def testIncompleteProtectedViewNoPermission(self):
+ def testIncompleteProtectedView(self):
self.assertRaises(ConfigurationError, xmlconfig.file,
"xmlrpc_error.zcml", xmlrpc.tests)
+ def testNoPermission(self):
+ self.assertRaises(ConfigurationError, xmlconfig.file,
+ "xmlrpc_noperm.zcml", xmlrpc.tests)
+
def test_no_name(self):
xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
v = zapi.getMultiAdapter((ob, request), name='index')
@@ -86,9 +90,7 @@
v = zapi.getMultiAdapter((ob, request), name='action')
self.assertEqual(v(), 'done')
-
-
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(DirectivesTest),
Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml 2005-11-16 21:36:41 UTC (rev 40180)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml 2005-11-16 21:56:51 UTC (rev 40181)
@@ -4,29 +4,30 @@
<include package="zope.app.publisher.xmlrpc" file="meta.zcml"/>
<include package="zope.app.security" file="meta.zcml"/>
-
- <xmlrpc:view
+
+ <xmlrpc:view
name="test"
class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
/>
- <xmlrpc:view
+ <xmlrpc:view
name="test2"
class="zope.app.component.tests.views.V1"
for="zope.app.component.tests.views.IC"
permission="zope.Public"
- interface="zope.app.component.tests.views.IV"
+ interface="zope.app.component.tests.views.IV"
/>
- <xmlrpc:view
+ <xmlrpc:view
name="test3"
class="zope.app.component.tests.views.V1"
for="zope.app.component.tests.views.IC"
permission="zope.Public"
methods="action" />
- <xmlrpc:view
+ <xmlrpc:view
name="test4"
class="zope.app.component.tests.views.V1"
for="zope.app.component.tests.views.IC"
@@ -34,7 +35,7 @@
methods="action"
interface="zope.app.component.tests.views.IV" />
- <xmlrpc:view
+ <xmlrpc:view
name="test5"
class="zope.app.component.tests.views.V1"
for="zope.app.component.tests.views.IC"
@@ -42,12 +43,13 @@
methods="action index"
interface="zope.app.component.tests.views.IV" />
-
- <xmlrpc:view
+
+ <xmlrpc:view
class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
+ for="zope.app.component.tests.views.IC"
interface="zope.app.component.tests.views.IV"
methods="action"
+ permission="zope.Public"
/>
</configure>
Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml 2005-11-16 21:36:41 UTC (rev 40180)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml 2005-11-16 21:56:51 UTC (rev 40181)
@@ -3,11 +3,12 @@
i18n_domain="zope">
<include package="zope.app.publisher.xmlrpc" file="meta.zcml"/>
-
- <xmlrpc:view
+
+ <xmlrpc:view
name="test"
factory="zope.component.tests.views.V1"
for="zope.component.tests.views.IC"
- methods="action index" />
+ methods="action index"
+ permission="zope.Public" />
</configure>
Added: Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcml
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcml 2005-11-16 21:36:41 UTC (rev 40180)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcml 2005-11-16 21:56:51 UTC (rev 40181)
@@ -0,0 +1,13 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
+ i18n_domain="zope">
+
+ <include package="zope.app.publisher.xmlrpc" file="meta.zcml"/>
+
+ <xmlrpc:view
+ name="test"
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ />
+
+</configure>
Property changes on: Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Zope3-Checkins
mailing list