Commit 40e886c5 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Don't access the object too early

    getId is invoked before the updateLocalRolesOnSecurityGroups is invoked, so Shadow user has no permission on the context.
parent 616051b0
...@@ -31,19 +31,19 @@ subscription_request = context.subscription_request_module.newContent( ...@@ -31,19 +31,19 @@ subscription_request = context.subscription_request_module.newContent(
subscription_request.setDefaultEmailText(email) subscription_request.setDefaultEmailText(email)
def wrapWithShadow(subscription_request, amount, subscription_reference): def wrapWithShadow(subscription_request, amount, subscription_reference, subscription_request_id):
subscription_request.activate(tag="subscription_condition_%s" % subscription_request.getId() subscription_request.activate(tag="subscription_condition_%s" % subscription_request_id
).SubscriptionRequest_applyCondition(subscription_reference, target_language) ).SubscriptionRequest_applyCondition(subscription_reference, target_language)
return subscription_request.SubscriptionRequest_requestPaymentTransaction( return subscription_request.SubscriptionRequest_requestPaymentTransaction(
amount=amount, amount=amount,
tag="subscription_%s" % subscription_request.getId(), tag="subscription_%s" % subscription_request_id,
target_language=target_language target_language=target_language
) )
payment = person.Person_restrictMethodAsShadowUser( payment = person.Person_restrictMethodAsShadowUser(
shadow_document=person, shadow_document=person,
callable_object=wrapWithShadow, callable_object=wrapWithShadow,
argument_list=[subscription_request, user_input_dict["amount"], subscription_reference]) argument_list=[subscription_request, user_input_dict["amount"], subscription_reference, subscription_request.getId()])
if batch_mode: if batch_mode:
return {'subscription' : subscription_request.getRelativeUrl(), 'payment': payment.getRelativeUrl() } return {'subscription' : subscription_request.getRelativeUrl(), 'payment': payment.getRelativeUrl() }
......
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