Commit 612ee830 authored by Jérome Perrin's avatar Jérome Perrin

*: update scripts using assignRoleToPrincipal to use manage_assignRoleToPrincipals

Starting from PAS 1.10.0, assignRoleToPrincipal is private, only
manage_assignRoleToPrincipals can be used from restricted python.
parent 4dd4abca
Pipeline #15300 failed with stage
in 0 seconds
......@@ -6,5 +6,12 @@ if not acl_users.getUserById('super_user'):
password='super_user',
confirm='super_user',
)
acl_users.zodb_roles.assignRoleToPrincipal('Manager', 'super_user')
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
acl_users.zodb_roles.manage_assignRoleToPrincipals(
'Manager',
('super_user',),
RESPONSE=response)
response.setStatus(200)
return 'Done'
......@@ -6,5 +6,11 @@ if not acl_users.getUserById('user_logout_test'):
password='user_logout_test',
confirm='user_logout_test',
)
acl_users.zodb_roles.assignRoleToPrincipal('Manager', 'user_logout_test')
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
acl_users.zodb_roles.manage_assignRoleToPrincipals(
'Manager',
('user_logout_test',),
RESPONSE=response)
response.setStatus(200)
return 'done'
......@@ -11,7 +11,13 @@ if not acl_users.getUserById('tiosafe_sync_user'):
password='tiosafe_sync_user',
confirm='tiosafe_sync_user',
)
acl_users.zodb_roles.assignRoleToPrincipal('Manager', 'tiosafe_sync_user')
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
acl_users.zodb_roles.manage_assignRoleToPrincipals(
'Manager',
('tiosafe_sync_user',),
RESPONSE=response)
response.setStatus(200)
node_list = ['invoiced_person_module', 'person_module', 'organisation_module']
resource_list = ['product_module',]
......
......@@ -11,7 +11,13 @@ if not acl_users.getUserById('tiosafe_sync_user'):
password='tiosafe_sync_user',
confirm='tiosafe_sync_user',
)
acl_users.zodb_roles.assignRoleToPrincipal('Manager', 'tiosafe_sync_user')
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
acl_users.zodb_roles.manage_assignRoleToPrincipals(
'Manager',
('tiosafe_sync_user',),
RESPONSE=response)
response.setStatus(200)
node_list = ['person_module', 'organisation_module']
resource_list = ['product_module',]
......
......@@ -8,7 +8,13 @@ if not acl_users.getUserById('tiosafe_sync_user'):
password='tiosafe_sync_user',
confirm='tiosafe_sync_user',
)
acl_users.zodb_roles.assignRoleToPrincipal('Manager', 'tiosafe_sync_user')
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
acl_users.zodb_roles.manage_assignRoleToPrincipals(
'Manager',
('tiosafe_sync_user',),
RESPONSE=response)
response.setStatus(200)
for im in context.objectValues(portal_type="Integration Module"):
......
......@@ -14,7 +14,13 @@ if not acl_users.getUserById('tiosafe_sync_user'):
password='tiosafe_sync_user',
confirm='tiosafe_sync_user',
)
acl_users.zodb_roles.assignRoleToPrincipal('Manager', 'tiosafe_sync_user')
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
acl_users.zodb_roles.manage_assignRoleToPrincipals(
'Manager',
('tiosafe_sync_user',),
RESPONSE=response)
response.setStatus(200)
# this dict map the portal type with their type
mapping_type_dict = {
......
......@@ -30,7 +30,13 @@ if person is None:
login.validate()
# XXX (lucas): These tests must be able to run on an instance without security.
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
for role in ('Assignee', 'Assignor', 'Associate', 'Auditor', 'Owner'):
portal.acl_users.zodb_roles.assignRoleToPrincipal(role, person.Person_getUserId())
portal.acl_users.zodb_roles.manage_assignRoleToPrincipals(
role,
(person.Person_getUserId(),),
RESPONSE=response)
response.setStatus(200)
return 'Done.'
......@@ -30,7 +30,13 @@ if person is None:
login.validate()
# XXX (lucas): These tests must be able to run on an instance without security.
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
for role in ('Assignee', 'Assignor', 'Associate', 'Auditor', 'Owner'):
portal.acl_users.zodb_roles.assignRoleToPrincipal(role, person.Person_getUserId())
portal.acl_users.zodb_roles.manage_assignRoleToPrincipals(
role,
(person.Person_getUserId(),),
RESPONSE=response)
response.setStatus(200)
return 'Done.'
......@@ -6,5 +6,11 @@ if not acl_users.getUserById('user_logout_test'):
password='user_logout_test',
confirm='user_logout_test',
)
acl_users.zodb_roles.assignRoleToPrincipal('Manager', 'user_logout_test')
# BBB for PAS 1.9.0 we pass a response and undo the redirect
response = container.REQUEST.RESPONSE
acl_users.zodb_roles.manage_assignRoleToPrincipals(
'Manager',
('user_logout_test',),
RESPONSE=response)
response.setStatus(200)
return 'done'
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