Commit 3030f962 authored by Rafael Monnerat's avatar Rafael Monnerat

Make sure that if the Object Parent does not have one permission (View and...

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.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23224 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7d4542a9
...@@ -1261,6 +1261,8 @@ class TestPropertySheet: ...@@ -1261,6 +1261,8 @@ class TestPropertySheet:
self.assertEquals(email.getDefaultAvailableLanguage(), 'ja') self.assertEquals(email.getDefaultAvailableLanguage(), 'ja')
self.assertEquals(email.getAvailableLanguageList(), ('ja', 'fr', 'en')) self.assertEquals(email.getAvailableLanguageList(), ('ja', 'fr', 'en'))
def test_20_AsContext(self,quiet=quiet, run=run_all_test): def test_20_AsContext(self,quiet=quiet, run=run_all_test):
"""asContext method return a temporary copy of an object. """asContext method return a temporary copy of an object.
Any modification made to the copy does not change the original object. Any modification made to the copy does not change the original object.
...@@ -1983,6 +1985,28 @@ class TestPropertySheet: ...@@ -1983,6 +1985,28 @@ class TestPropertySheet:
self.assertEquals(["Gamma System"], self.assertEquals(["Gamma System"],
foo.getWrappedRegionTitleList(checked_permission='View')) 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): def test_category_accessor_to_non_existing_documents(self):
# tests behaviour of category accessors with relations to non existing # tests behaviour of category accessors with relations to non existing
# documents. # documents.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment