Commit 47784ddb authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_panel: Get Variation as user rather them Shadow User

   Shadow user have no access to Allocation Supply exclusive to the user, so access the variation before change into shadow user.
parent 5b71d0ff
......@@ -22,12 +22,12 @@ if aggregate_uid is None:
destination_value=destination_value)
if allocation_predicate_list:
def wrapWithShadow(destination_value, allocation_predicate_list, project):
def wrapWithShadow(destination_value, variation_category_list, project):
try:
subscription_request = software_product.Resource_createSubscriptionRequest(
destination_value,
# [software_type, software_release],
allocation_predicate_list[0].getVariationCategoryList(),
variation_category_list,
project,
temp_object=True
)
......@@ -54,10 +54,13 @@ if aggregate_uid is None:
return price_information, is_future_balance_negative
# Shadow user may not have access to the allocation predicates, so get the variation
# relative url as the logged user.
variation_category_list = allocation_predicate_list[0].getVariationCategoryList()
price_information, is_future_balance_negative = destination_value.Person_restrictMethodAsShadowUser(
shadow_document=destination_value,
callable_object=wrapWithShadow,
argument_list=[destination_value, allocation_predicate_list, context])
argument_list=[destination_value, variation_category_list, context])
if price_information is not None:
keep_items['is_future_balance_negative'] = is_future_balance_negative
......
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