Commit cbcdd677 authored by Rafael Monnerat's avatar Rafael Monnerat

master: Get rid of ERP5Site_getAuthenticatedMemberPersonValue

This API is deprecated, replaced by appropriated one
parent f2940825
...@@ -3,7 +3,8 @@ network = context ...@@ -3,7 +3,8 @@ network = context
# XXX - The use of current authenticated person will return always 'Close' if # XXX - The use of current authenticated person will return always 'Close' if
# the person is administrator (such as 'zope' user) but not the owner of computer # the person is administrator (such as 'zope' user) but not the owner of computer
# #
# person = context.ERP5Site_getAuthenticatedMemberPersonValue() # person = portal.portal_membership.getAuthenticatedMember().getUserValue()
allocation_state = 'Close' allocation_state = 'Close'
software_type = '' software_type = ''
filter_kw = {} filter_kw = {}
......
...@@ -6,5 +6,5 @@ reference = "NET-%s" % portal.portal_ids.generateNewId( ...@@ -6,5 +6,5 @@ reference = "NET-%s" % portal.portal_ids.generateNewId(
context.edit(reference=reference) context.edit(reference=reference)
#source_administration=context.ERP5Site_getAuthenticatedMemberPersonValue().getRelativeUrl() #source_administration=portal.portal_membership.getAuthenticatedMember().getUserValue().getRelativeUrl()
#network.validate() #network.validate()
...@@ -88,7 +88,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin): ...@@ -88,7 +88,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
self.assertNotEqual(None, welcome_message) self.assertNotEqual(None, welcome_message)
def _getCurrentHostingSubscriptionList(self): def _getCurrentHostingSubscriptionList(self):
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is not None: if person is not None:
return self.portal.portal_catalog( return self.portal.portal_catalog(
......
...@@ -390,7 +390,7 @@ class TestSlapOSCorePersonComputerSupply(SlapOSTestCaseMixin): ...@@ -390,7 +390,7 @@ class TestSlapOSCorePersonComputerSupply(SlapOSTestCaseMixin):
# Login as new user # Login as new user
self.login(person_user.getUserId()) self.login(person_user.getUserId())
new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() new_person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
self.assertEqual(person_user.getRelativeUrl(), new_person.getRelativeUrl()) self.assertEqual(person_user.getRelativeUrl(), new_person.getRelativeUrl())
def beforeTearDown(self): def beforeTearDown(self):
...@@ -1919,14 +1919,14 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -1919,14 +1919,14 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
# Login as new user # Login as new user
self.login(person_user.getUserId()) self.login(person_user.getUserId())
new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() new_person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
self.assertEqual(person_user.getRelativeUrl(), new_person.getRelativeUrl()) self.assertEqual(person_user.getRelativeUrl(), new_person.getRelativeUrl())
def beforeTearDown(self): def beforeTearDown(self):
pass pass
def test_Person_requestSoftwareInstance_requiredParameter(self): def test_Person_requestSoftwareInstance_requiredParameter(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2022,7 +2022,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -2022,7 +2022,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
) )
def test_Person_requestSoftwareInstance_acceptedState(self): def test_Person_requestSoftwareInstance_acceptedState(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2082,7 +2082,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -2082,7 +2082,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
self.assertEqual(None, hosting_subscription) self.assertEqual(None, hosting_subscription)
def test_Person_requestSoftwareInstance_returnHostingSubscriptionUrl(self): def test_Person_requestSoftwareInstance_returnHostingSubscriptionUrl(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2109,7 +2109,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -2109,7 +2109,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
hosting_subscription.getPortalType()) hosting_subscription.getPortalType())
def test_Person_requestSoftwareInstance_createHostingSubscription(self): def test_Person_requestSoftwareInstance_createHostingSubscription(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2149,7 +2149,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -2149,7 +2149,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
self.assertEqual("validated", hosting_subscription.getValidationState()) self.assertEqual("validated", hosting_subscription.getValidationState())
def test_Person_requestSoftwareInstance_HostingSubscriptionNotReindexed(self): def test_Person_requestSoftwareInstance_HostingSubscriptionNotReindexed(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2185,7 +2185,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -2185,7 +2185,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
@expectedFailure @expectedFailure
def test_Person_requestSoftwareInstance_updateHostingSubscription(self): def test_Person_requestSoftwareInstance_updateHostingSubscription(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2253,7 +2253,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -2253,7 +2253,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
self.assertEqual("validated", hosting_subscription.getValidationState()) self.assertEqual("validated", hosting_subscription.getValidationState())
def test_Person_requestSoftwareInstance_duplicatedHostingSubscription(self): def test_Person_requestSoftwareInstance_duplicatedHostingSubscription(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2295,7 +2295,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -2295,7 +2295,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
) )
def test_Person_requestSoftwareInstance_HostingSubscriptionNewTitle(self): def test_Person_requestSoftwareInstance_HostingSubscriptionNewTitle(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2363,7 +2363,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -2363,7 +2363,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
self.assertEqual("validated", hosting_subscription2.getValidationState()) self.assertEqual("validated", hosting_subscription2.getValidationState())
def test_Person_requestSoftwareInstance_deletedHostingSubscription(self): def test_Person_requestSoftwareInstance_deletedHostingSubscription(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2402,7 +2402,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): ...@@ -2402,7 +2402,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
self.assertEqual("destroy_requested", hosting_subscription.getSlapState()) self.assertEqual("destroy_requested", hosting_subscription.getSlapState())
def test_Person_requestSoftwareInstance_noConflictWithDeletedHostingSubscription(self): def test_Person_requestSoftwareInstance_noConflictWithDeletedHostingSubscription(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
software_release = self.generateNewSoftwareReleaseUrl() software_release = self.generateNewSoftwareReleaseUrl()
software_title = "test" software_title = "test"
...@@ -2467,14 +2467,14 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin): ...@@ -2467,14 +2467,14 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin):
# Login as new user # Login as new user
self.login(person_user.getUserId()) self.login(person_user.getUserId())
new_person = portal.ERP5Site_getAuthenticatedMemberPersonValue() new_person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
self.assertEqual(person_user.getRelativeUrl(), new_person.getRelativeUrl()) self.assertEqual(person_user.getRelativeUrl(), new_person.getRelativeUrl())
def beforeTearDown(self): def beforeTearDown(self):
pass pass
def test_request_requiredParameter(self): def test_request_requiredParameter(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
# computer_title is mandatory # computer_title is mandatory
self.assertRaises(TypeError, person.requestComputer) self.assertRaises(TypeError, person.requestComputer)
...@@ -2484,7 +2484,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin): ...@@ -2484,7 +2484,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin):
person.requestComputer(computer_title=computer_title) person.requestComputer(computer_title=computer_title)
def test_request(self): def test_request(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
computer_title = self.generateNewComputerTitle() computer_title = self.generateNewComputerTitle()
person.requestComputer(computer_title=computer_title) person.requestComputer(computer_title=computer_title)
...@@ -2499,7 +2499,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin): ...@@ -2499,7 +2499,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin):
self.assertNotEqual(None, computer_reference) self.assertNotEqual(None, computer_reference)
def test_request_createdComputer(self): def test_request_createdComputer(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
previous_id = self.getPortalObject().portal_ids\ previous_id = self.getPortalObject().portal_ids\
.generateNewId(id_group='slap_computer_reference', .generateNewId(id_group='slap_computer_reference',
...@@ -2530,7 +2530,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin): ...@@ -2530,7 +2530,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin):
self.assertEqual('open', computer.getCapacityScope()) self.assertEqual('open', computer.getCapacityScope())
def test_request_notReindexedCompute(self): def test_request_notReindexedCompute(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
computer_title = self.generateNewComputerTitle() computer_title = self.generateNewComputerTitle()
person.requestComputer(computer_title=computer_title) person.requestComputer(computer_title=computer_title)
...@@ -2539,7 +2539,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin): ...@@ -2539,7 +2539,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin):
computer_title=computer_title) computer_title=computer_title)
def test_multiple_request_createdComputer(self): def test_multiple_request_createdComputer(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
previous_id = self.getPortalObject().portal_ids\ previous_id = self.getPortalObject().portal_ids\
.generateNewId(id_group='slap_computer_reference', .generateNewId(id_group='slap_computer_reference',
...@@ -2624,7 +2624,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin): ...@@ -2624,7 +2624,7 @@ class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin):
self.assertEqual('open', computer2.getCapacityScope()) self.assertEqual('open', computer2.getCapacityScope())
def test_request_duplicatedComputer(self): def test_request_duplicatedComputer(self):
person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
computer_title = self.generateNewComputerTitle() computer_title = self.generateNewComputerTitle()
person.requestComputer(computer_title=computer_title) person.requestComputer(computer_title=computer_title)
......
computer = state_change['object'] computer = state_change['object']
portal = computer.getPortalObject() portal = computer.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
computer.edit( computer.edit(
allocation_scope='open/personal', allocation_scope='open/personal',
source_administration_value=person, source_administration_value=person,
......
portal = context.getPortalObject() portal = context.getPortalObject()
kw['portal_type'] = ["Support Request", "Regularisation Request", "Upgrade Decision"] kw['portal_type'] = ["Support Request", "Regularisation Request", "Upgrade Decision"]
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person: if person:
kw['default_destination_decision_uid'] = person.getUid() kw['default_destination_decision_uid'] = person.getUid()
kw['simulation_state'] = "NOT cancelled" kw['simulation_state'] = "NOT cancelled"
......
portal = context.getPortalObject() portal = context.getPortalObject()
kw['portal_type'] = ["Support Request", "Regularisation Request", "Upgrade Decision"] kw['portal_type'] = ["Support Request", "Regularisation Request", "Upgrade Decision"]
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person: if person:
kw['default_destination_decision_uid'] = person.getUid() kw['default_destination_decision_uid'] = person.getUid()
kw['simulation_state'] = "NOT cancelled" kw['simulation_state'] = "NOT cancelled"
......
web_message = state_object["object"] web_message = state_object["object"]
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is None: if person is None:
return return
......
import json import json
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
web_site = context.getWebSiteValue() web_site = context.getWebSiteValue()
request_method = "POST" request_method = "POST"
......
import json import json
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
# Revoke user certificate # Revoke user certificate
try: try:
......
import json import json
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is None: if person is None:
raise ValueError("User Not Found") raise ValueError("User Not Found")
......
import json import json
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is None: if person is None:
raise ValueError("User Not Found") raise ValueError("User Not Found")
......
person = context.ERP5Site_getAuthenticatedMemberPersonValue() portal = context.getPortalObject()
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
request = context.REQUEST request = context.REQUEST
response = request.RESPONSE response = request.RESPONSE
......
import json import json
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
request = context.REQUEST request = context.REQUEST
response = request.RESPONSE response = request.RESPONSE
......
""" This script is required due the ValueError, should be more HTTP friendly. """ This script is required due the ValueError, should be more HTTP friendly.
""" """
person = context.ERP5Site_getAuthenticatedMemberPersonValue() portal = context.getPortalObject()
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
request = context.REQUEST request = context.REQUEST
response = request.RESPONSE response = request.RESPONSE
import json import json
......
...@@ -26,7 +26,7 @@ if hosting_subscription is not None: ...@@ -26,7 +26,7 @@ if hosting_subscription is not None:
# The URL should come from the URL Probably # The URL should come from the URL Probably
url = context.getUrlString() url = context.getUrlString()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is None: if person is None:
raise ValueError("You cannot request without been logged in as a user.") raise ValueError("You cannot request without been logged in as a user.")
......
...@@ -35,7 +35,7 @@ else: ...@@ -35,7 +35,7 @@ else:
result = "Unpaid" result = "Unpaid"
else: else:
# Check if mapping exists # Check if mapping exists
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
payzen_id = person.Person_restrictMethodAsShadowUser( payzen_id = person.Person_restrictMethodAsShadowUser(
shadow_document=person, shadow_document=person,
callable_object=payment.PaymentTransaction_getPayzenId, callable_object=payment.PaymentTransaction_getPayzenId,
......
from zExceptions import Unauthorized from zExceptions import Unauthorized
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if getattr(context, "PaymentTransaction_getVADSUrlDict", None) is None: if getattr(context, "PaymentTransaction_getVADSUrlDict", None) is None:
raise ValueError("PaymentTransaction_getVADSUrlDict is missing on this site") raise ValueError("PaymentTransaction_getVADSUrlDict is missing on this site")
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
anonymous pay their Payment Transactions before login. anonymous pay their Payment Transactions before login.
""" """
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
def wrapWithShadow(payment_transaction, web_site): def wrapWithShadow(payment_transaction, web_site):
return payment_transaction.PaymentTransaction_redirectToManualPayzenPayment(web_site) return payment_transaction.PaymentTransaction_redirectToManualPayzenPayment(web_site)
......
...@@ -548,7 +548,7 @@ class SlapTool(BaseTool): ...@@ -548,7 +548,7 @@ class SlapTool(BaseTool):
@convertToREST @convertToREST
def _requestComputer(self, computer_title): def _requestComputer(self, computer_title):
portal = self.getPortalObject() portal = self.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
person.requestComputer(computer_title=computer_title) person.requestComputer(computer_title=computer_title)
computer = Computer(self.REQUEST.get('computer_reference').decode("UTF-8")) computer = Computer(self.REQUEST.get('computer_reference').decode("UTF-8"))
return xml_marshaller.xml_marshaller.dumps(computer) return xml_marshaller.xml_marshaller.dumps(computer)
...@@ -1303,7 +1303,7 @@ class SlapTool(BaseTool): ...@@ -1303,7 +1303,7 @@ class SlapTool(BaseTool):
self._storeLastData(key, value) self._storeLastData(key, value)
else: else:
# requested as root, so done by human # requested as root, so done by human
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
kw = dict(software_release=software_release, kw = dict(software_release=software_release,
software_type=software_type, software_type=software_type,
software_title=partition_reference, software_title=partition_reference,
......
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