Commit 33962d77 authored by Nicolas Delaby's avatar Nicolas Delaby

Extend test for use case when User has View permission but not on Requested local role

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19128 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d7fbb92b
...@@ -1686,6 +1686,28 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ...@@ -1686,6 +1686,28 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
self.assertEquals(1, folder.countFolder(title='Object Title', self.assertEquals(1, folder.countFolder(title='Object Title',
local_roles='Assignee')[0][0]) local_roles='Assignee')[0][0])
#Test if one of user Role with View permission return Object
ob1.manage_addLocalRoles('bob', ['Assignee', 'Auditor'])
ob1.manage_permission('View', ['Assignor', 'Auditor'], 0)
ob1.reindexObject()
get_transaction().commit()
self.tic()
user = getSecurityManager().getUser()
self.assertTrue(user.has_permission('View', ob1))
self.assertTrue(user.has_role('Assignee', ob1))
result_list = [r.getId() for r in ctool(title='Object Title', local_roles='Assignee')]
self.assertEquals(2, len(result_list))
self.assertEquals(2,
ctool.countResults(title='Object Title',
local_roles='Assignee')[0][0])
# this also work for searchFolder and countFolder
self.assertEquals(2, len(folder.searchFolder(title='Object Title',
local_roles='Assignee')))
self.assertEquals(2, folder.countFolder(title='Object Title',
local_roles='Assignee')[0][0])
def test_51_SearchWithKeyWords(self, quiet=quiet, run=run_all_test): def test_51_SearchWithKeyWords(self, quiet=quiet, run=run_all_test):
if not run: return if not run: return
if not quiet: if not quiet:
......
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