Commit 976e8f92 authored by Vincent Pelletier's avatar Vincent Pelletier

testERP5Catalog: Roles are granted to user ids, not Person references.

parent bd23b72e
...@@ -2833,8 +2833,6 @@ VALUES ...@@ -2833,8 +2833,6 @@ VALUES
This is a case when Person document containting reference with local role This is a case when Person document containting reference with local role
which shall be monovalued is reindexed for first time. which shall be monovalued is reindexed for first time.
""" """
user = 'person_document_user_name'
sql_connection = self.getSQLConnection() sql_connection = self.getSQLConnection()
def query(sql): def query(sql):
result = sql_connection.manage_test(sql) result = sql_connection.manage_test(sql)
...@@ -2928,9 +2926,10 @@ VALUES ...@@ -2928,9 +2926,10 @@ VALUES
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.commit() self.commit()
person = self.portal.person_module.newContent(portal_type='Person', person = self.portal.person_module.newContent(portal_type='Person')
reference=user) user_id = person.Person_getUserId()
person.manage_setLocalRoles(user, ['Assignee']) person.manage_setLocalRoles(user_id, ['Assignee'])
self.tic() self.tic()
roles_and_users_result = query('select * from roles_and_users where uid = (select security_uid from catalog where uid = %s)' % person.getUid()) roles_and_users_result = query('select * from roles_and_users where uid = (select security_uid from catalog where uid = %s)' % person.getUid())
...@@ -2942,7 +2941,7 @@ VALUES ...@@ -2942,7 +2941,7 @@ VALUES
['Assignee', 'Assignor', 'Associate', 'Auditor', 'Author', 'Manager'] ['Assignee', 'Assignor', 'Associate', 'Auditor', 'Author', 'Manager']
) )
# check that user has optimised security declaration # check that user has optimised security declaration
self.assertEqual(local_roles_table_result['viewable_assignee_reference'], user) self.assertEqual(local_roles_table_result['viewable_assignee_reference'], user_id)
finally: finally:
sql_catalog.sql_catalog_object_list = \ sql_catalog.sql_catalog_object_list = \
current_sql_catalog_object_list current_sql_catalog_object_list
......
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