Commit 8ef2911c authored by Boris Kocherov's avatar Boris Kocherov

Merge branch 'vincentB_erp5_officejs_application' into bk_officejs

parents 9a7fadd9 c0f30097

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from Products.ERP5Type.JSONEncoder import encodeInJson as dumps from Products.ERP5Type.JSONEncoder import encodeInJson as dumps
portal = context.getPortalObject() portal = context.getPortalObject()
reference = portal.portal_membership.getAuthenticatedMember().getUserName() reference = portal.portal_membership.getAuthenticatedMember().getIdOrUserName()
processing = None processing = None
if reference == "Anonymous User": if reference == "Anonymous User":
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
portal = context.getPortalObject() portal = context.getPortalObject()
member = portal.portal_membership.getAuthenticatedMember() member = portal.portal_membership.getAuthenticatedMember()
reference = member.getUserName() reference = member.getIdOrUserName()
if reference == "Anonymous User": if reference == "Anonymous User":
return context.WebSection_viewUploadFileDialog() return context.WebSection_viewUploadFileDialog()
else: else:
......
...@@ -14,7 +14,7 @@ if access_token_document.getValidationState() == 'validated': ...@@ -14,7 +14,7 @@ if access_token_document.getValidationState() == 'validated':
agent_document = access_token_document.getAgentValue() agent_document = access_token_document.getAgentValue()
if agent_document is not None: if agent_document is not None:
result = agent_document.getReference(None) result = agent_document.Person_getUserId()
comment = "Token usage accepted" comment = "Token usage accepted"
access_token_document.invalidate(comment=comment) access_token_document.invalidate(comment=comment)
......
...@@ -22,6 +22,6 @@ if access_token_document.getValidationState() == 'validated': ...@@ -22,6 +22,6 @@ if access_token_document.getValidationState() == 'validated':
agent_document = access_token_document.getAgentValue() agent_document = access_token_document.getAgentValue()
if agent_document is not None: if agent_document is not None:
result = agent_document.getReference(None) result = agent_document.Person_getUserId()
return result return result
...@@ -45,7 +45,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase): ...@@ -45,7 +45,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
indexing is done. """ indexing is done. """
person_module = self.getPersonModule() person_module = self.getPersonModule()
person = person_module.newContent(portal_type='Person', person = person_module.newContent(portal_type='Person',
reference='TESTP-' + new_id) user_id='TESTP-' + new_id)
person.newContent(portal_type = 'Assignment').open() person.newContent(portal_type = 'Assignment').open()
transaction.commit() transaction.commit()
return person return person
...@@ -91,7 +91,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase): ...@@ -91,7 +91,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
self.portal.REQUEST.form["access_token_secret"] = access_token.getReference() self.portal.REQUEST.form["access_token_secret"] = access_token.getReference()
result = self._getTokenCredential(self.portal.REQUEST) result = self._getTokenCredential(self.portal.REQUEST)
self.assertEqual(result.get('external_login'), person.getReference()) self.assertEqual(result.get('external_login'), person.Person_getUserId())
def test_bad_token(self): def test_bad_token(self):
person = self.person = self._createPerson(self.new_id) person = self.person = self._createPerson(self.new_id)
...@@ -129,7 +129,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase): ...@@ -129,7 +129,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
result = access_token.RestrictedAccessToken_getExternalLogin() result = access_token.RestrictedAccessToken_getExternalLogin()
self.assertEqual(result, person.getReference()) self.assertEqual(result, person.Person_getUserId())
self.assertEqual(access_token.getValidationState(), 'validated') self.assertEqual(access_token.getValidationState(), 'validated')
def test_RestrictedAccessToken_getExternalLogin_access_token_secret(self): def test_RestrictedAccessToken_getExternalLogin_access_token_secret(self):
...@@ -156,7 +156,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase): ...@@ -156,7 +156,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
result = access_token.RestrictedAccessToken_getExternalLogin() result = access_token.RestrictedAccessToken_getExternalLogin()
self.assertEqual(result, person.getReference()) self.assertEqual(result, person.Person_getUserId())
self.assertEqual(access_token.getValidationState(), 'validated') self.assertEqual(access_token.getValidationState(), 'validated')
def test_RestrictedAccessToken_getExternalLogin_no_agent(self): def test_RestrictedAccessToken_getExternalLogin_no_agent(self):
...@@ -226,7 +226,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase): ...@@ -226,7 +226,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
result = access_token.OneTimeRestrictedAccessToken_getExternalLogin() result = access_token.OneTimeRestrictedAccessToken_getExternalLogin()
self.assertEqual(result, person.getReference()) self.assertEqual(result, person.Person_getUserId())
self.assertEqual(access_token.getValidationState(), 'invalidated') self.assertEqual(access_token.getValidationState(), 'invalidated')
def test_OneTimeRestrictedAccessToken_getExternalLogin_wrong_values(self): def test_OneTimeRestrictedAccessToken_getExternalLogin_wrong_values(self):
......
portal = context.getPortalObject() portal = context.getPortalObject()
params = portal.ERP5Accounting_getParams(selection_name) params = portal.ERP5Accounting_getParams(selection_name)
selection_params = context.portal_selections.getSelectionParamsFor(selection_name)
params['omit_asset_increase'] = omit_asset_increase params['omit_asset_increase'] = omit_asset_increase
params['omit_asset_decrease'] = omit_asset_decrease params['omit_asset_decrease'] = omit_asset_decrease
...@@ -19,17 +18,11 @@ if kw.get('closed_summary'): ...@@ -19,17 +18,11 @@ if kw.get('closed_summary'):
params['closed_summary'] = kw['closed_summary'] params['closed_summary'] = kw['closed_summary']
if context.portal_selections.getSelectionInvertModeFor(selection_name): if context.portal_selections.getSelectionInvertModeFor(selection_name):
params['node_uid'] = context.portal_selections.getSelectionInvertModeUidListFor(selection_name) params['node_uid'] = context.portal_selections.getSelectionInvertModeUidListFor(selection_name)
elif 'title' in selection_params or \ else:
'preferred_gap_id' in selection_params or \ selection_params = context.portal_selections.getSelectionParamsFor(selection_name)
'id' in selection_params or \
'translated_validation_state_title' in selection_params:
selection_params['ignore_unknown_columns'] = True selection_params['ignore_unknown_columns'] = True
# if list is filtered, apply the same filter here
params['node_uid'] = [x.uid for x in params['node_uid'] = [x.uid for x in
portal.portal_catalog(**selection_params)] portal.portal_catalog(**selection_params)]
else:
# make sure we only have Accounts as nodes
params['node_category'] = ['account_type',]
# Remove params used internally by ERP5Accounting_getParams before passing to inventory API # Remove params used internally by ERP5Accounting_getParams before passing to inventory API
params.pop("period_start_date", None) params.pop("period_start_date", None)
......
...@@ -89,7 +89,7 @@ item_list = getItemList( category=category, ...@@ -89,7 +89,7 @@ item_list = getItemList( category=category,
portal_path=context.getPortalObject().getPhysicalPath(), portal_path=context.getPortalObject().getPhysicalPath(),
mirror=mirror, mirror=mirror,
omit_filter=omit_filter, # XXX possible optim: only one cache if omit_filter omit_filter=omit_filter, # XXX possible optim: only one cache if omit_filter
user_name=str(getSecurityManager().getUser()), user_name=getSecurityManager().getUser().getIdOrUserName(),
simulation_state=simulation_state) simulation_state=simulation_state)
# make sure that the current value is included in this list, this is # make sure that the current value is included in this list, this is
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -22,7 +22,7 @@ context.activate().AccountingTransactionModule_viewFrenchAccountingTransactionFi ...@@ -22,7 +22,7 @@ context.activate().AccountingTransactionModule_viewFrenchAccountingTransactionFi
at_date, at_date,
simulation_state, simulation_state,
ledger, ledger,
user_name=person_value.getReference(), user_name=person_value.Person_getUserId(),
tag=tag, tag=tag,
aggregate_tag=aggregate_tag) aggregate_tag=aggregate_tag)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<pagetemplate startframe='content' id='FirstPage'> <pagetemplate startframe='content' id='FirstPage'>
<static> <static>
<infostring align="left" x="1cm" y= "29cm" size="8" font="Helvetica" color="(0,0,0)" <infostring align="left" x="1cm" y= "29cm" size="8" font="Helvetica" color="(0,0,0)"
tal:content="python: here.Base_translateString('ui', 'Printed by %(user)s at %(date)s') % {'user':user.getUserName(), 'date':DateTime()}" >Printed by</infostring> tal:content="python: here.Base_translateString('ui', 'Printed by %(user)s at %(date)s') % {'user':user.getIdOrUserName(), 'date':DateTime()}" >Printed by</infostring>
<infostring align="left" x="18cm" y= "0.5cm" size="10" font="Helvetica" color="(0,0,0)" >Page %(page)s</infostring> <infostring align="left" x="18cm" y= "0.5cm" size="10" font="Helvetica" color="(0,0,0)" >Page %(page)s</infostring>
</static> </static>
<frame showBoundary='0' leftpadding='0.1cm' height='23.94cm' width='17.59cm' rightpadding='0.1cm' y='2cm' x='2cm' nextid='content' toppadding='0.2cm' id='content' bottompadding='0.5cm'/> <frame showBoundary='0' leftpadding='0.1cm' height='23.94cm' width='17.59cm' rightpadding='0.1cm' y='2cm' x='2cm' nextid='content' toppadding='0.2cm' id='content' bottompadding='0.5cm'/>
......
...@@ -30,7 +30,7 @@ for entity in ( portal.organisation_module.objectValues() + ...@@ -30,7 +30,7 @@ for entity in ( portal.organisation_module.objectValues() +
# enable preference # enable preference
ptool = portal.portal_preferences ptool = portal.portal_preferences
pref = ptool.accounting_zuite_preference pref = ptool.accounting_zuite_preference
if pref.owner_info()['id'] != str(context.REQUEST.AUTHENTICATED_USER): if pref.owner_info()['id'] != context.REQUEST.AUTHENTICATED_USER.getId():
# we have to 'own' the preference for the test # we have to 'own' the preference for the test
ptool = portal.portal_preferences ptool = portal.portal_preferences
# pref.setId('old_accounting_zuite_preference') # pref.setId('old_accounting_zuite_preference')
......
...@@ -83,7 +83,9 @@ class TestERP5Administration(InventoryAPITestCase): ...@@ -83,7 +83,9 @@ class TestERP5Administration(InventoryAPITestCase):
def test_check_consistency_alarm(self): def test_check_consistency_alarm(self):
alarm = self.portal.portal_alarms.check_consistency alarm = self.portal.portal_alarms.check_consistency
person = self.portal.person_module.newContent(portal_type='Person') # Here we disable user_id so that Person_createUserPreference will not be called
# automatically.
person = self.portal.person_module.newContent(portal_type='Person', user_id=None)
# this document will be non consistent, for PropertyTypeValidity # this document will be non consistent, for PropertyTypeValidity
person.title = 3 person.title = 3
# tic right now to make sure the person is indexed, indeed the alarm # tic right now to make sure the person is indexed, indeed the alarm
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<workflow_chain> <workflow_chain>
<chain> <chain>
<type>Person</type> <type>ERP5 Login</type>
<workflow>password_interaction_workflow</workflow> <workflow>password_interaction_workflow</workflow>
</chain> </chain>
</workflow_chain> </workflow_chain>
\ No newline at end of file
"""
Form validator which will check if password is valid for the user.
"""
from Products.ERP5Type.Document import newTempBase
from Products.Formulator.Errors import ValidationError
portal = context.getPortalObject()
message_dict = { 0: 'Unknown error',
-1: 'Too short.',
-2: 'Not complex enough.',
-3: 'You have changed your password too recently.',
-4: 'You have already used this password.',
-5: 'You can not use any parts of your first and last name in password.'}
def doValidation(person, password):
# raise so Formulator shows proper message
result_code_list = person.Person_analyzePassword(password)
if result_code_list!=[]:
translateString = context.Base_translateString
message = ' '.join([translateString(message_dict[x]) for x in result_code_list])
raise ValidationError('external_validator_failed', context, error_text=message)
return 1
user_login = request.get('field_user_login', None)
# find Person object (or authenticated member) and validate it on it (password recovered for an existing account)
person = context.ERP5Site_getAuthenticatedMemberPersonValue(user_login)
if person is not None:
return doValidation(person, password)
# use a temp object (new account created)
first_name = request.get('field_your_first_name', None)
last_name = request.get('field_your_last_name', None)
kw = {'title': '%s %s' %(first_name, last_name),
'first_name': first_name,
'last_name': last_name}
person = newTempBase(portal, kw['title'], **kw)
return doValidation(person, password)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>password, request</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_isPasswordValid</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>password, request={}</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Login_analyzePassword</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>brain, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Login_getListboxUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Login_isLoginBlocked</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Login_isPasswordExpired</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Form validator which will check if password is valid for the user.
"""
from Products.ERP5Type.Document import newTempBase
from Products.Formulator.Errors import ValidationError
portal = context.getPortalObject()
message_dict = { 0: 'Unknown error',
-1: 'Too short.',
-2: 'Not complex enough.',
-3: 'You have changed your password too recently.',
-4: 'You have already used this password.',
-5: 'You can not use any parts of your first and last name in password.'}
def doValidation(login, password):
# raise so Formulator shows proper message
result_code_list = login.analyzePassword(password)
if result_code_list!=[]:
translateString = context.Base_translateString
message = ' '.join([translateString(message_dict[x]) for x in result_code_list])
raise ValidationError('external_validator_failed', context, error_text=message)
return 1
return doValidation(context, password)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>password, request</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Login_isPasswordValid</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Login_notifyLoginFailure</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Login_notifyPasswordExpire</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id="view", cancel_url=None, batch_mode=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Login_unblockLogin</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>password, request={}</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_analyzePassword</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>brain, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_getListboxUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_isLoginBlocked</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_isPasswordExpired</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_notifyLoginFailure</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_notifyPasswordExpire</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id="view", cancel_url=None, batch_mode=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_unblockLogin</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -35,6 +35,6 @@ for person, failure_list in all_blocked_user_login_dict.items(): ...@@ -35,6 +35,6 @@ for person, failure_list in all_blocked_user_login_dict.items():
person.getTitle(), person.getTitle(),
**{'title': person.getTitle(), **{'title': person.getTitle(),
'count':len(failure_list), 'count':len(failure_list),
'reference': person.getReference(), 'reference': person.Person_getUserId(),
'url': person.absolute_url()})) 'url': person.absolute_url()}))
return blocked_user_login_list return blocked_user_login_list
...@@ -174,15 +174,15 @@ ...@@ -174,15 +174,15 @@
<list> <list>
<tuple> <tuple>
<string>title</string> <string>title</string>
<string>Person_getListboxUrl</string> <string>Login_getListboxUrl</string>
</tuple> </tuple>
<tuple> <tuple>
<string>reference</string> <string>reference</string>
<string>Person_getListboxUrl</string> <string>Login_getListboxUrl</string>
</tuple> </tuple>
<tuple> <tuple>
<string>count</string> <string>count</string>
<string>Person_getListboxUrl</string> <string>Login_getListboxUrl</string>
</tuple> </tuple>
</list> </list>
</value> </value>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <value>
<list> <list>
<string>Person_changePassword</string> <string>afterChangePassword</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -72,10 +72,16 @@ ...@@ -72,10 +72,16 @@
<key> <string>portal_type_filter</string> </key> <key> <string>portal_type_filter</string> </key>
<value> <value>
<list> <list>
<string>Person</string> <string>ERP5 Login</string>
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
<value> <value>
......
from DateTime import DateTime
portal = context.getPortalObject()
person = state_change['object']
# check preferences and save only if set
number_of_last_password_to_check = portal.portal_preferences.getPreferredNumberOfLastPasswordToCheck()
if number_of_last_password_to_check is not None and number_of_last_password_to_check:
# save password and modification date
current_password = person.getPassword()
if current_password is not None:
password_event = portal.system_event_module.newContent(portal_type = 'Password Event',
source_value = person,
destination_value = person,
password = current_password)
password_event.confirm()
# Person_isPasswordExpired cache the wrong result if document is not in catalog.
# As the document is created in the same transaction, it is possible to force reindexation
password_event.immediateReindexObject()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_changePassword</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
login = state_change['object']
portal = login.getPortalObject()
# check preferences and save only if set
number_of_last_password_to_check = portal.portal_preferences.getPreferredNumberOfLastPasswordToCheck()
if number_of_last_password_to_check is not None and number_of_last_password_to_check:
# save password and modification date
current_password = login.getPassword()
if current_password is not None:
password_event = portal.system_event_module.newContent(portal_type='Password Event',
source_value=login,
destination_value=login,
password=current_password)
password_event.confirm()
# Person_isPasswordExpired cache the wrong result if document is not in catalog.
# As the document is created in the same transaction, it is possible to force reindexation
password_event.immediateReindexObject()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>afterChangePassword</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Person | password_interaction_workflow ERP5 Login | password_interaction_workflow
\ No newline at end of file \ No newline at end of file
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -6,7 +6,7 @@ return destination ...@@ -6,7 +6,7 @@ return destination
# OLD METHOD user logged in # OLD METHOD user logged in
#user_id = context.portal_membership.getAuthenticatedMember().getUserName() #user_id = context.portal_membership.getAuthenticatedMember().getId()
# NEW METHOD must use owner to know site letter # NEW METHOD must use owner to know site letter
old_group_list = context.get_local_roles() old_group_list = context.get_local_roles()
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -14,7 +14,7 @@ resource = transaction.CashDelivery_checkCounterInventory(source = destination, ...@@ -14,7 +14,7 @@ resource = transaction.CashDelivery_checkCounterInventory(source = destination,
#if len(vliste) != 0: #if len(vliste) != 0:
# raise ValidationFailed, (vliste[0].getMessage(),) # raise ValidationFailed, (vliste[0].getMessage(),)
user_id = transaction.portal_membership.getAuthenticatedMember().getUserName() user_id = transaction.portal_membership.getAuthenticatedMember().getId()
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id) site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)
# context.log('validateVaultBalance site_list',site_list) # context.log('validateVaultBalance site_list',site_list)
destination = transaction.getDestination() destination = transaction.getDestination()
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -5,7 +5,7 @@ transaction = state_change['object'] ...@@ -5,7 +5,7 @@ transaction = state_change['object']
# Compute the source form the vault choosen by # Compute the source form the vault choosen by
# the accountant and find the counter with the # the accountant and find the counter with the
# user logged in # user logged in
user_id = transaction.portal_membership.getAuthenticatedMember().getUserName() user_id = transaction.portal_membership.getAuthenticatedMember().getId()
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id) site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)
# context.log('validateVaultBalance site_list',site_list) # context.log('validateVaultBalance site_list',site_list)
source = transaction.getSource() source = transaction.getSource()
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName </string> </value> <value> <string>user/getIdOrUserName </string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
if user_id is None: if user_id is None:
user_id = context.portal_membership.getAuthenticatedMember().getUserName() user_id = context.portal_membership.getAuthenticatedMember().getId()
def getFunctionList(user_id=user_id): def getFunctionList(user_id=user_id):
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
if user_id is None: if user_id is None:
user_id = context.portal_membership.getAuthenticatedMember().getUserName() user_id = context.portal_membership.getAuthenticatedMember().getId()
def getGroupList(user_id=user_id): def getGroupList(user_id=user_id):
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
if user_id is None: if user_id is None:
user_id = context.portal_membership.getAuthenticatedMember().getUserName() user_id = context.portal_membership.getAuthenticatedMember().getId()
def getSiteList(user_id=user_id): def getSiteList(user_id=user_id):
......
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
user_id = context.portal_membership.getAuthenticatedMember().getUserName() user_id = context.portal_membership.getAuthenticatedMember().getId()
def getUserSiteUid(user_id): def getUserSiteUid(user_id):
return context.Baobab_getUserAssignedRootSite(user_id=user_id, object=1).getSiteUid() return context.Baobab_getUserAssignedRootSite(user_id=user_id, object=1).getSiteUid()
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>user/getUserName</string> </value> <value> <string>user/getIdOrUserName</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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