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