[Erp5-report] r23224 - /erp5/trunk/products/ERP5Type/tests/testERP5Type.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Aug 28 14:10:34 CEST 2008


Author: rafael
Date: Thu Aug 28 14:10:28 2008
New Revision: 23224

URL: http://svn.erp5.org?rev=23224&view=rev
Log:
Make sure that if the Object Parent does not have one permission (View and Access contents information), is not possible use this permission as checked_permission.

If some object has no Permission to Access contents information all subobjects cannot be accessed, even if you View permission.


Modified:
    erp5/trunk/products/ERP5Type/tests/testERP5Type.py

Modified: erp5/trunk/products/ERP5Type/tests/testERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testERP5Type.py?rev=23224&r1=23223&r2=23224&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testERP5Type.py (original)
+++ erp5/trunk/products/ERP5Type/tests/testERP5Type.py Thu Aug 28 14:10:28 2008
@@ -1193,7 +1193,7 @@
                         person.getDefaultOrganisationTitle())
       self.assertEquals(other_pers_title,
                         other_pers.getDefaultOrganisationTitle())
-      
+
     def test_19b_AcquiredContentAccessorWithIdClash(self,quiet=quiet, run=run_all_test):
       """Tests a content setters do not set the property on acquired object
       that may have the same id, using same scenario as test_19
@@ -1261,6 +1261,8 @@
       self.assertEquals(email.getDefaultAvailableLanguage(), 'ja')
       self.assertEquals(email.getAvailableLanguageList(), ('ja', 'fr', 'en'))
 
+
+
     def test_20_AsContext(self,quiet=quiet, run=run_all_test):
       """asContext method return a temporary copy of an object.
       Any modification made to the copy does not change the original object.
@@ -1982,6 +1984,28 @@
       self.assertRaises(Unauthorized, foo.getWrappedRegionTitleList)
       self.assertEquals(["Gamma System"],
           foo.getWrappedRegionTitleList(checked_permission='View'))
+
+      # Remove permission from parent object, the behaviour of acessor should
+      # be kept. If you have no permission to the parent, this means that the 
+      # sub objects cannot be accessed too.
+      gamma.getParentValue().manage_permission("View", [], acquire=0)
+
+      # getProperty is used by forms
+      self.assertEquals(None,foo.getProperty("wrapped_region_title_list",
+                                                            checked_permission='View'))
+      self.assertEquals(None,
+                foo.getWrappedRegionTitleList(checked_permission='View'))
+
+      self.assertEquals(["Gamma System"],
+                      foo.getWrappedRegionTitleList(checked_permission='Access contents information'))
+
+      gamma.getParentValue().manage_permission("Access contents information", [], acquire=0)
+      self.assertEquals(None,
+                foo.getWrappedRegionTitleList(checked_permission='View'))
+
+      self.assertEquals(None,
+                      foo.getWrappedRegionTitleList(checked_permission='Access contents information'))
+
 
     def test_category_accessor_to_non_existing_documents(self):
       # tests behaviour of category accessors with relations to non existing




More information about the Erp5-report mailing list