Commit ebbed4e7 authored by Vincent Pelletier's avatar Vincent Pelletier

Stop calling deprecated ERP5Site_getAuthenticatedMemberPersonValue.

git grep -l ERP5Site_getAuthenticatedMemberPersonValue | xargs sed -i 's!\.ERP5Site_getAuthenticatedMemberPersonValue()!.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()!g'
Plus s/portal.getPortalObject()/portal/g where modified by above regex.
Plus manual edits of the few remaining matches.
Special mention for DiscussionThreadModule_addReply, which forgot to
actually call the script.
parent b8afaa14
...@@ -10,7 +10,7 @@ result = {'group_list': [], ...@@ -10,7 +10,7 @@ result = {'group_list': [],
'site_list': [], 'site_list': [],
'function_list': [], 'function_list': [],
'destination_trade_relative_url': None} 'destination_trade_relative_url': None}
person = portal.ERP5Site_getAuthenticatedMemberPersonValue(user_name=user_name) person = portal.Base_getUserValueByUserId(user_name)
if person is None: if person is None:
return result return result
......
...@@ -4,7 +4,7 @@ If the user is only affected to one of the two involved sections' group, then we ...@@ -4,7 +4,7 @@ If the user is only affected to one of the two involved sections' group, then we
If the user is affected to both sections, then we use the user preference. If the user is affected to both sections, then we use the user preference.
''' '''
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if person is None: if person is None:
return '' return ''
......
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
portal = context.getPortalObject() portal = context.getPortalObject()
person_value = portal.ERP5Site_getAuthenticatedMemberPersonValue() person_value = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person_value is None: if person_value is None:
portal.changeSkin(None) portal.changeSkin(None)
return context.Base_redirect('view', keep_items=dict( return context.Base_redirect('view', keep_items=dict(
......
...@@ -9,7 +9,7 @@ result = {'group_list': [], ...@@ -9,7 +9,7 @@ result = {'group_list': [],
'site_list': [], 'site_list': [],
'function_list': [], 'function_list': [],
'destination_trade_relative_url': None} 'destination_trade_relative_url': None}
person = portal.ERP5Site_getAuthenticatedMemberPersonValue(user_name=user_name) person = portal.Base_getUserValueByUserId(user_name)
if person is None: if person is None:
return result return result
......
...@@ -9,7 +9,7 @@ def getPersonCareerDict(user_name): ...@@ -9,7 +9,7 @@ def getPersonCareerDict(user_name):
result = {'group_list': [], result = {'group_list': [],
'site_list': [], 'site_list': [],
} }
person = portal.ERP5Site_getAuthenticatedMemberPersonValue(user_name=user_name) person = portal.Base_getUserValueByUserId(user_name)
if person is None: if person is None:
return result return result
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
""" """
document = state_change['object'] document = state_change['object']
contributor_list = document.getContributorValueList() contributor_list = document.getContributorValueList()
person = document.ERP5Site_getAuthenticatedMemberPersonValue() person = document.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if person is not None and person not in contributor_list: if person is not None and person not in contributor_list:
# a real ERP5 Person object does exist # a real ERP5 Person object does exist
contributor_list.append(person) contributor_list.append(person)
......
"""Set connected user as shopping cart customer""" """Set connected user as shopping cart customer"""
shopping_cart = context.SaleOrder_getShoppingCart() shopping_cart = context.SaleOrder_getShoppingCart()
member = context.ERP5Site_getAuthenticatedMemberPersonValue() member = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
shopping_cart.edit(destination_section_value=member) shopping_cart.edit(destination_section_value=member)
"""Get property on Person of current user """Get property on Person of current user
Parameter: Parameter:
property_name -- property to get, Mandatory (String, Example: "title")""" property_name -- property to get, Mandatory (String, Example: "title")"""
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if person is not None: if person is not None:
return person.getProperty(property_name, None) return person.getProperty(property_name, None)
return None return None
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Parameter: Parameter:
property_name -- property to get, Mandatory (String, Example: 'title') property_name -- property to get, Mandatory (String, Example: 'title')
""" """
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if person is not None: if person is not None:
organisation = person.getDefaultCareerSubordinationValue() organisation = person.getDefaultCareerSubordinationValue()
if organisation is not None: if organisation is not None:
......
...@@ -43,7 +43,7 @@ credential_request.reindexObject(activate_kw=dict(tag='set_login_%s' % reference ...@@ -43,7 +43,7 @@ credential_request.reindexObject(activate_kw=dict(tag='set_login_%s' % reference
#We attach the current user to the credential request if not anonymous #We attach the current user to the credential request if not anonymous
if not context.portal_membership.isAnonymousUser(): if not context.portal_membership.isAnonymousUser():
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
destination_decision = [] destination_decision = []
if reference in [x.getReference() for x in person.objectValues(portal_type='ERP5 Login') if reference in [x.getReference() for x in person.objectValues(portal_type='ERP5 Login')
if x.getValidationState() == 'validated']: if x.getValidationState() == 'validated']:
......
"""Create a new credential update""" """Create a new credential update"""
portal_status_message="" portal_status_message=""
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if person is None: if person is None:
portal_status_message = context.Base_translateString("Can't find corresponding person, it's not possible to update your credentials.") portal_status_message = context.Base_translateString("Can't find corresponding person, it's not possible to update your credentials.")
else: else:
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and context.ERP5Site_getAuthenticatedMemberPersonValue().getCareerSubordinationTitle() or \'\'</string> </value> <value> <string>python: context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getCareerSubordinationTitle() or \'\'</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and context.ERP5Site_getAuthenticatedMemberPersonValue().getDefaultAddressCity() or \'\'</string> </value> <value> <string>python: context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getDefaultAddressCity() or \'\'</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and context.ERP5Site_getAuthenticatedMemberPersonValue().getDefaultAddressStreetAddress() or \'\'</string> </value> <value> <string>python: context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getDefaultAddressStreetAddress() or \'\'</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and context.ERP5Site_getAuthenticatedMemberPersonValue().getDefaultAddressZipCode() or \'\'</string> </value> <value> <string>python: context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getDefaultAddressZipCode() or \'\'</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and context.ERP5Site_getAuthenticatedMemberPersonValue().getDefaultEmailText() or \'\'</string> </value> <value> <string>python: context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getDefaultEmailText() or \'\'</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and context.ERP5Site_getAuthenticatedMemberPersonValue().getDefaultTelephoneText() or \'\'</string> </value> <value> <string>python: context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getDefaultTelephoneText() or \'\'</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and context.ERP5Site_getAuthenticatedMemberPersonValue().getFirstName() or \'\'</string> </value> <value> <string>python: context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getFirstName() or \'\'</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and context.ERP5Site_getAuthenticatedMemberPersonValue().getLastName() or \'\'</string> </value> <value> <string>python: context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getLastName() or \'\'</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -12,7 +12,7 @@ portal = context.getPortalObject() ...@@ -12,7 +12,7 @@ portal = context.getPortalObject()
portal_entity_type_list = portal.getPortalEntityTypeList() portal_entity_type_list = portal.getPortalEntityTypeList()
# Search current user ID # Search current user ID
logged_in_user_value = portal.ERP5Site_getAuthenticatedMemberPersonValue() logged_in_user_value = portal.portal_membership.getAuthenticatedMember().getUserValue()
start_date = DateTime() start_date = DateTime()
organisation = None organisation = None
......
portal = context.getPortalObject() portal = context.getPortalObject()
logged_in_user_value = portal.ERP5Site_getAuthenticatedMemberPersonValue() logged_in_user_value = portal.portal_membership.getAuthenticatedMember().getUserValue()
now = DateTime() now = DateTime()
if support_request_template: if support_request_template:
......
...@@ -8,7 +8,7 @@ portal = context.getPortalObject() ...@@ -8,7 +8,7 @@ portal = context.getPortalObject()
request = context.REQUEST request = context.REQUEST
event_id = request['id'] event_id = request['id']
user = portal.ERP5Site_getAuthenticatedMemberPersonValue() user = portal.portal_membership.getAuthenticatedMember().getUserValue()
# If we have a logged in user it's probably a backoffice agent. # If we have a logged in user it's probably a backoffice agent.
if user is None: if user is None:
# If the referer contains the url of the event we are probably viewing the event # If the referer contains the url of the event we are probably viewing the event
......
...@@ -8,7 +8,7 @@ portal = context.getPortalObject() ...@@ -8,7 +8,7 @@ portal = context.getPortalObject()
request = context.REQUEST request = context.REQUEST
event_id = request['id'] event_id = request['id']
user = portal.ERP5Site_getAuthenticatedMemberPersonValue() user = portal.portal_membership.getAuthenticatedMember().getUserValue()
# If we have a logged in user it's probably a backoffice agent. # If we have a logged in user it's probably a backoffice agent.
if user is None: if user is None:
# If the referer contains the url of the event we are probably viewing the event # If the referer contains the url of the event we are probably viewing the event
......
...@@ -4,7 +4,7 @@ event = context ...@@ -4,7 +4,7 @@ event = context
operator_list = event.getDestinationList() operator_list = event.getDestinationList()
try: try:
source_value = portal.ERP5Site_getAuthenticatedMemberPersonValue() source_value = portal.portal_membership.getAuthenticatedMember().getUserValue()
if source_value: if source_value:
operator_list.append(source_value.getRelativeUrl()) operator_list.append(source_value.getRelativeUrl())
except ValueError: except ValueError:
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
item_list = [ ('', ''), item_list = [ ('', ''),
(context.getDestinationTitle(), context.getDestination()) ] (context.getDestinationTitle(), context.getDestination()) ]
logged_in_user = context.ERP5Site_getAuthenticatedMemberPersonValue() logged_in_user = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if logged_in_user is not None and logged_in_user.getRelativeUrl() != context.getDestination(): if logged_in_user is not None and logged_in_user.getRelativeUrl() != context.getDestination():
item_list.append((logged_in_user.getTitle(), logged_in_user.getRelativeUrl())) item_list.append((logged_in_user.getTitle(), logged_in_user.getRelativeUrl()))
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
if user_name is None: if user_name is None:
raise ValueError("User name must be provided") raise ValueError("User name must be provided")
person_value = context.ERP5Site_getAuthenticatedMemberPersonValue( person_value = context.Base_getUserValueByUserId(user_name)
user_name=user_name)
result = None result = None
if not context.isAcknowledged(user_name=user_name): if not context.isAcknowledged(user_name=user_name):
......
...@@ -5,7 +5,7 @@ This script is here so that we can easily customized depending on the context ev ...@@ -5,7 +5,7 @@ This script is here so that we can easily customized depending on the context ev
if context.hasSource(): if context.hasSource():
return context.getSource() return context.getSource()
logged_in_user = context.ERP5Site_getAuthenticatedMemberPersonValue() logged_in_user = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if logged_in_user is not None: if logged_in_user is not None:
return logged_in_user.getRelativeUrl() return logged_in_user.getRelativeUrl()
return '' return ''
portal = context.getPortalObject() portal = context.getPortalObject()
event_list = [] event_list = []
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is not None: if person is not None:
# XXX Wrong way to filter the same person in source OR destination. # XXX Wrong way to filter the same person in source OR destination.
......
...@@ -5,6 +5,6 @@ portal = context.getPortalObject() ...@@ -5,6 +5,6 @@ portal = context.getPortalObject()
new_event = portal.event_module.newContent(portal_type="Phone Call") new_event = portal.event_module.newContent(portal_type="Phone Call")
new_event.setDestinationValue(context) new_event.setDestinationValue(context)
new_event.setSourceValue(portal.ERP5Site_getAuthenticatedMemberPersonValue()) new_event.setSourceValue(portal.portal_membership.getAuthenticatedMember().getUserValue())
return new_event.Base_redirect("view") return new_event.Base_redirect("view")
...@@ -7,7 +7,7 @@ translate = context.Base_translateString ...@@ -7,7 +7,7 @@ translate = context.Base_translateString
new_event = portal.event_module.newContent(portal_type="Mail Message") new_event = portal.event_module.newContent(portal_type="Mail Message")
new_event.setDestinationValue(context) new_event.setDestinationValue(context)
new_event.setSourceValue(portal.ERP5Site_getAuthenticatedMemberPersonValue()) new_event.setSourceValue(portal.portal_membership.getAuthenticatedMember().getUserValue())
portal_status_message = translate("Real time chat will be available soon. Please use email instead.") portal_status_message = translate("Real time chat will be available soon. Please use email instead.")
return new_event.Base_redirect("view", \ return new_event.Base_redirect("view", \
......
...@@ -5,6 +5,6 @@ portal = context.getPortalObject() ...@@ -5,6 +5,6 @@ portal = context.getPortalObject()
new_event = portal.event_module.newContent(portal_type = "Mail Message") new_event = portal.event_module.newContent(portal_type = "Mail Message")
new_event.setDestinationValue(context) new_event.setDestinationValue(context)
new_event.setSourceValue(portal.ERP5Site_getAuthenticatedMemberPersonValue()) new_event.setSourceValue(portal.portal_membership.getAuthenticatedMember().getUserValue())
return new_event.Base_redirect("view") return new_event.Base_redirect("view")
portal = context.getPortalObject() portal = context.getPortalObject()
portal_type = 'Data Protection Request' portal_type = 'Data Protection Request'
module = portal.getDefaultModule(portal_type) module = portal.getDefaultModule(portal_type)
current_user = portal.ERP5Site_getAuthenticatedMemberPersonValue() current_user = portal.portal_membership.getAuthenticatedMember().getUserValue()
reference_index = portal.portal_ids.generateNewId(id_group=('data_protection_request'), default=1) reference_index = portal.portal_ids.generateNewId(id_group=('data_protection_request'), default=1)
reference = 'DPR-%s' % (reference_index,) reference = 'DPR-%s' % (reference_index,)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
from DateTime import DateTime from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
discussion_thread = context discussion_thread = context
is_temp_object = discussion_thread.isTempObject() is_temp_object = discussion_thread.isTempObject()
......
...@@ -6,7 +6,7 @@ from zExceptions import Unauthorized ...@@ -6,7 +6,7 @@ from zExceptions import Unauthorized
MARKER = ['', None, []] MARKER = ['', None, []]
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
version = '001' version = '001'
language = portal.Localizer.get_selected_language() language = portal.Localizer.get_selected_language()
...@@ -131,7 +131,7 @@ if send_notification_text not in ('', None): ...@@ -131,7 +131,7 @@ if send_notification_text not in ('', None):
else: else:
mail_text = notification_message.asText( mail_text = notification_message.asText(
substitution_method_parameter_dict={'mapping_dict':notification_mapping_dict}) substitution_method_parameter_dict={'mapping_dict':notification_mapping_dict})
sender = portal.ERP5Site_getAuthenticatedMemberPersonValue() sender = portal.portal_membership.getAuthenticatedMember().getUserValue()
#Send email #Send email
for recipient in person_list: for recipient in person_list:
portal.portal_notifications.sendMessage( portal.portal_notifications.sendMessage(
......
...@@ -5,7 +5,7 @@ edit_kw = {'content_type': portal.portal_preferences.getPreferredTextFormat(), ...@@ -5,7 +5,7 @@ edit_kw = {'content_type': portal.portal_preferences.getPreferredTextFormat(),
'destination_value_list': context.BugLine_getRecipientValueList()} 'destination_value_list': context.BugLine_getRecipientValueList()}
# Define a Reporter as Source Trade # Define a Reporter as Source Trade
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if person is not None: if person is not None:
edit_kw['source_value'] = person edit_kw['source_value'] = person
......
sender = context.ERP5Site_getAuthenticatedMemberPersonValue() sender = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if sender is None: if sender is None:
sender = context.getDestinationValue() sender = context.getDestinationValue()
......
# Define a Reporter as Source Trade # Define a Reporter as Source Trade
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if person is not None: if person is not None:
context.setSourceTradeValue(person) context.setSourceTradeValue(person)
......
person = context.ERP5Site_getAuthenticatedMemberPersonValue person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
discussion_post = context.newContent( discussion_post = context.newContent(
title=title, title=title,
......
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
translateString = context.Base_translateString translateString = context.Base_translateString
discussion_thread = context.newContent( discussion_thread = context.newContent(
......
...@@ -5,7 +5,7 @@ portal = context.getPortalObject() ...@@ -5,7 +5,7 @@ portal = context.getPortalObject()
request = context.REQUEST request = context.REQUEST
event_id = request['id'] event_id = request['id']
user = portal.ERP5Site_getAuthenticatedMemberPersonValue() user = portal.portal_membership.getAuthenticatedMember().getUserValue()
# If we have a logged in user it's probably a backoffice agent. # If we have a logged in user it's probably a backoffice agent.
if user is None: if user is None:
# If the referer contains the url of the event we are probably viewing the event # If the referer contains the url of the event we are probably viewing the event
......
...@@ -960,7 +960,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -960,7 +960,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
} }
# Handle also other kind of users: instance, computer, master # Handle also other kind of users: instance, computer, master
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is not None: if person is not None:
result_dict['_links']['me'] = { result_dict['_links']['me'] = {
"href": default_document_uri_template % { "href": default_document_uri_template % {
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: context.getProperty(\'group\') or context.ERP5Site_getAuthenticatedMemberPersonValue() is not None and here.ERP5Site_getAuthenticatedMemberPersonValue().getGroup() or \'\'</string> </value> <value> <string>python: context.getProperty(\'group\') or context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getGroup() or \'\'</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -14,7 +14,7 @@ if user_name is None and context.portal_membership.isAnonymousUser(): ...@@ -14,7 +14,7 @@ if user_name is None and context.portal_membership.isAnonymousUser():
return context.Base_redirect(form_id="view", keep_items={'portal_status_message':msg}) return context.Base_redirect(form_id="view", keep_items={'portal_status_message':msg})
# Call generic erp5_base method to find user value # Call generic erp5_base method to find user value
user_object = context.ERP5Site_getAuthenticatedMemberPersonValue(user_name=user_name) user_object = context.Base_getUserValueByUserId(user_name)
# Return if no such user # Return if no such user
if user_object is None: if user_object is None:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
This script is used in "NO ZODB" approach mode although it can be used in other UI parts This script is used in "NO ZODB" approach mode although it can be used in other UI parts
as well. as well.
""" """
person = context.ERP5Site_getAuthenticatedMemberPersonValue(reference) person = context.Base_getUserValueByUserId(reference)
if person is not None: if person is not None:
person.Base_redirect(form_id='view') person.Base_redirect(form_id='view')
else: else:
......
from DateTime import DateTime from DateTime import DateTime
context.setStopDate(DateTime()) context.setStopDate(DateTime())
me = context.ERP5Site_getAuthenticatedMemberPersonValue() me = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if me is not None: if me is not None:
context.setSourceAdministrationValue(me) context.setSourceAdministrationValue(me)
section = me.getDefaultCareerSubordinationValue() section = me.getDefaultCareerSubordinationValue()
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: [("source_relative_url", context.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue().getRelativeUrl()), ("simulation_state", ["confirmed", "started"])]</string> </value> <value> <string>python: [("source_relative_url", context.getPortalObject().getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getRelativeUrl()), ("simulation_state", ["confirmed", "started"])]</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -9,7 +9,7 @@ if not 'Deferred' in portal.portal_skins.getSkinSelections(): ...@@ -9,7 +9,7 @@ if not 'Deferred' in portal.portal_skins.getSkinSelections():
return context.Base_redirect('view', keep_items=dict( return context.Base_redirect('view', keep_items=dict(
portal_status_message=N_("Deferred style must be installed to run this report"))) portal_status_message=N_("Deferred style must be installed to run this report")))
person_value = portal.ERP5Site_getAuthenticatedMemberPersonValue() person_value = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person_value is None: if person_value is None:
portal.changeSkin(None) portal.changeSkin(None)
return context.Base_redirect('view', keep_items=dict( return context.Base_redirect('view', keep_items=dict(
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
# and it causes a problem when record is cloned. # and it causes a problem when record is cloned.
context.setContentType(None) context.setContentType(None)
context.setSourceValue(context.ERP5Site_getAuthenticatedMemberPersonValue()) context.setSourceValue(context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue())
context.Event_init() context.Event_init()
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
NOTE: we usually asume that there is only a single owner NOTE: we usually asume that there is only a single owner
or that, at least, only the first owner matters for or that, at least, only the first owner matters for
the "My Documents" list. the "My Documents" list.
TODO:
- how can we make sure that is is consistent with
ERP5Site_getAuthenticatedMemberPersonValue
in erp5_base ?
""" """
from zExceptions import Unauthorized from zExceptions import Unauthorized
getUserValueByUserId = context.Base_getUserValueByUserId getUserValueByUserId = context.Base_getUserValueByUserId
......
...@@ -19,7 +19,7 @@ edit_kw = {'portal_type': portal_type, ...@@ -19,7 +19,7 @@ edit_kw = {'portal_type': portal_type,
'resource': resource, 'resource': resource,
'source_carrier': context.getWebSectionValue().getRelativeUrl(), 'source_carrier': context.getWebSectionValue().getRelativeUrl(),
} }
connected_user = portal.ERP5Site_getAuthenticatedMemberPersonValue() connected_user = portal.portal_membership.getAuthenticatedMember().getUserValue()
if connected_user is not None: if connected_user is not None:
edit_kw['source'] = connected_user.getRelativeUrl() edit_kw['source'] = connected_user.getRelativeUrl()
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.ERP5Site_getAuthenticatedMemberPersonValue() is not None and here.ERP5Site_getAuthenticatedMemberPersonValue().getSubordinationTitle() or None</string> </value> <value> <string>python: here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getSubordinationTitle() or None</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.ERP5Site_getAuthenticatedMemberPersonValue() is not None and here.ERP5Site_getAuthenticatedMemberPersonValue().getDefaultEmailText() or None</string> </value> <value> <string>python: here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getDefaultEmailText() or None</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.ERP5Site_getAuthenticatedMemberPersonValue() is not None and here.ERP5Site_getAuthenticatedMemberPersonValue().getFirstName() or None</string> </value> <value> <string>python: here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getFirstName() or None</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.ERP5Site_getAuthenticatedMemberPersonValue() is not None and here.ERP5Site_getAuthenticatedMemberPersonValue().getLastName() or None</string> </value> <value> <string>python: here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getLastName() or None</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.ERP5Site_getAuthenticatedMemberPersonValue() is not None and here.ERP5Site_getAuthenticatedMemberPersonValue().getDefaultTelephoneText() or None</string> </value> <value> <string>python: here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() is not None and here.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue().getDefaultTelephoneText() or None</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -16,7 +16,7 @@ if context.portal_membership.isAnonymousUser(): ...@@ -16,7 +16,7 @@ if context.portal_membership.isAnonymousUser():
keep_items={'portal_status_message':msg}) keep_items={'portal_status_message':msg})
# Call generic erp5_base method to find user value # Call generic erp5_base method to find user value
person_object = context.ERP5Site_getAuthenticatedMemberPersonValue(user) person_object = context.Base_getUserValueByUserId(user)
# Return if no such user # Return if no such user
if person_object is None: if person_object is None:
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
<ul tal:define="group python: document_stats['documents_groups_sorted'][0]; <ul tal:define="group python: document_stats['documents_groups_sorted'][0];
group_obj python: here.restrictedTraverse('portal_categories/group/%s' %group[0]); group_obj python: here.restrictedTraverse('portal_categories/group/%s' %group[0]);
person python: document_stats['documents_owners_sorted'][0]; person python: document_stats['documents_owners_sorted'][0];
person_obj python: here.ERP5Site_getAuthenticatedMemberPersonValue(person[0]);"> person_obj python: here.Base_getUserValueByUserId(person[0]);">
<li><b>Person:</b> <li><b>Person:</b>
<a href="" tal:attributes="href person_obj/absolute_url"> <a href="" tal:attributes="href person_obj/absolute_url">
<span tal:content="person_obj/getTitle"/> <span tal:content="person_obj/getTitle"/>
......
...@@ -37,7 +37,7 @@ else: ...@@ -37,7 +37,7 @@ else:
# XXX Hardcoded behaviour for JS app. # XXX Hardcoded behaviour for JS app.
# Expect came_from to be an URL template # Expect came_from to be an URL template
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
url_parameter = "n.me" url_parameter = "n.me"
pattern = '{[&|?]%s}' % url_parameter pattern = '{[&|?]%s}' % url_parameter
if (person is None): if (person is None):
......
...@@ -2,7 +2,7 @@ from DateTime import DateTime ...@@ -2,7 +2,7 @@ from DateTime import DateTime
form = context.REQUEST.form form = context.REQUEST.form
person = context.ERP5Site_getAuthenticatedMemberPersonValue() person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
sender_email = "freecloudalliance@freecloudalliance.org" sender_email = "freecloudalliance@freecloudalliance.org"
if person and person.getEmail(): if person and person.getEmail():
......
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if not person: if not person:
return None return None
......
...@@ -370,7 +370,7 @@ class TestUNG(ERP5TypeTestCase): ...@@ -370,7 +370,7 @@ class TestUNG(ERP5TypeTestCase):
response = json.loads(portal.ERP5Site_checkIfUserExist(**kw)) response = json.loads(portal.ERP5Site_checkIfUserExist(**kw))
self.assertEqual(response.get("response"), False) self.assertEqual(response.get("response"), False)
self.loginByUserName("ung_reference") self.loginByUserName("ung_reference")
user = portal.ERP5Site_getAuthenticatedMemberPersonValue() user = portal.portal_membership.getAuthenticatedMember().getUserValue()
self.assertEqual(user.getFirstName(), "UNG") self.assertEqual(user.getFirstName(), "UNG")
def testWebSection_addGadgetList(self): def testWebSection_addGadgetList(self):
......
...@@ -83,8 +83,7 @@ class AcknowledgeableMixin: ...@@ -83,8 +83,7 @@ class AcknowledgeableMixin:
result = self.hasAcknowledgementActivity(user_name=user_name) result = self.hasAcknowledgementActivity(user_name=user_name)
if not result: if not result:
# Check in the catalog if we can find an acknowledgement # Check in the catalog if we can find an acknowledgement
person_value = self.ERP5Site_getAuthenticatedMemberPersonValue( person_value = self.Base_getUserValueByUserId(user_name)
user_name=user_name)
if len(self.portal_catalog(portal_type='Acknowledgement', if len(self.portal_catalog(portal_type='Acknowledgement',
default_causality_uid=self.getUid(), default_causality_uid=self.getUid(),
default_destination_uid=person_value.getUid(), default_destination_uid=person_value.getUid(),
......
...@@ -123,8 +123,7 @@ class AcknowledgementTool(BaseTool): ...@@ -123,8 +123,7 @@ class AcknowledgementTool(BaseTool):
document_list = [] document_list = []
if user_name is not None: if user_name is not None:
portal = self.getPortalObject() portal = self.getPortalObject()
person_value = portal.ERP5Site_getAuthenticatedMemberPersonValue( person_value = portal.Base_getUserValueByUserId(user_name)
user_name=user_name)
if person_value is not None: if person_value is not None:
now = DateTime() now = DateTime()
# First look at all event that define the current user as destination # First look at all event that define the current user as destination
......
...@@ -57,20 +57,20 @@ class TestCertificateAuthority(ERP5TypeTestCase): ...@@ -57,20 +57,20 @@ class TestCertificateAuthority(ERP5TypeTestCase):
def test_person_request_certificate(self): def test_person_request_certificate(self):
user_id, login = self._createPerson() user_id, login = self._createPerson()
self.loginByUserName(login) self.loginByUserName(login)
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
certificate = person.getCertificate() certificate = person.getCertificate()
self.assertTrue('CN=%s' % user_id in certificate['certificate']) self.assertTrue('CN=%s' % user_id in certificate['certificate'])
def test_person_revoke_certificate(self): def test_person_revoke_certificate(self):
user_id, login = self._createPerson() user_id, login = self._createPerson()
self.loginByUserName(login) self.loginByUserName(login)
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
self.assertRaises(ValueError, person.revokeCertificate) self.assertRaises(ValueError, person.revokeCertificate)
def test_person_request_revoke_certificate(self): def test_person_request_revoke_certificate(self):
user_id, login = self._createPerson() user_id, login = self._createPerson()
self.loginByUserName(login) self.loginByUserName(login)
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
certificate = person.getCertificate() certificate = person.getCertificate()
self.assertTrue('CN=%s' % user_id in certificate['certificate']) self.assertTrue('CN=%s' % user_id in certificate['certificate'])
person.revokeCertificate() person.revokeCertificate()
...@@ -78,7 +78,7 @@ class TestCertificateAuthority(ERP5TypeTestCase): ...@@ -78,7 +78,7 @@ class TestCertificateAuthority(ERP5TypeTestCase):
def test_person_request_certificate_twice(self): def test_person_request_certificate_twice(self):
user_id, login = self._createPerson() user_id, login = self._createPerson()
self.loginByUserName(login) self.loginByUserName(login)
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
certificate = person.getCertificate() certificate = person.getCertificate()
self.assertTrue('CN=%s' % user_id in certificate['certificate']) self.assertTrue('CN=%s' % user_id in certificate['certificate'])
self.assertRaises(ValueError, person.getCertificate) self.assertRaises(ValueError, person.getCertificate)
...@@ -87,7 +87,7 @@ class TestCertificateAuthority(ERP5TypeTestCase): ...@@ -87,7 +87,7 @@ class TestCertificateAuthority(ERP5TypeTestCase):
user_id, login = self._createPerson() user_id, login = self._createPerson()
user_id2, login2 = self._createPerson() user_id2, login2 = self._createPerson()
self.loginByUserName(login) self.loginByUserName(login)
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
self.loginByUserName(login2) self.loginByUserName(login2)
self.assertRaises(Unauthorized, person.getCertificate) self.assertRaises(Unauthorized, person.getCertificate)
...@@ -95,7 +95,7 @@ class TestCertificateAuthority(ERP5TypeTestCase): ...@@ -95,7 +95,7 @@ class TestCertificateAuthority(ERP5TypeTestCase):
user_id, login = self._createPerson() user_id, login = self._createPerson()
user_id2, login2 = self._createPerson() user_id2, login2 = self._createPerson()
self.loginByUserName(login) self.loginByUserName(login)
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
certificate = person.getCertificate() certificate = person.getCertificate()
self.assertTrue('CN=%s' % user_id in certificate['certificate']) self.assertTrue('CN=%s' % user_id in certificate['certificate'])
self.loginByUserName(login2) self.loginByUserName(login2)
......
...@@ -310,8 +310,7 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -310,8 +310,7 @@ Hé Hé Hé!""", page.asText().strip())
self.tic() self.tic()
# find person object by reference # find person object by reference
person = website.ERP5Site_getAuthenticatedMemberPersonValue( person = website.Base_getUserValueByUserId(kw['reference'])
kw['reference'])
self.assertEqual(person.getReference(), kw['reference']) self.assertEqual(person.getReference(), kw['reference'])
self.assertEqual(person.getFirstName(), kw['first_name']) self.assertEqual(person.getFirstName(), kw['first_name'])
self.assertEqual(person.getLastName(), kw['last_name']) self.assertEqual(person.getLastName(), kw['last_name'])
......
...@@ -308,7 +308,7 @@ class Git(WorkingCopy): ...@@ -308,7 +308,7 @@ class Git(WorkingCopy):
if author: if author:
return author.groups() return author.groups()
#try: #try:
# author = portal.ERP5Site_getAuthenticatedMemberPersonValue() # author = portal.portal_membership.getAuthenticatedMember().getUserValue()
# name = author.getTitle() # name = author.getTitle()
# email = author.getDefaultEmailText() # email = author.getDefaultEmailText()
# if name and email: # if name and email:
......
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