Commit 95e44779 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Check if the user has permisson before provide a URL

  Only get the product image if the user has access to it.
parent 1a7d9ab1
portal = context.getPortalObject() portal = context.getPortalObject()
url_string = context.getUrlString() url_string = context.getUrlString()
# set default value of image_url to the panel's logo # set default value of image_url to the panel's logo
image_url = "gadget_slapos_panel.png" image_url = "gadget_slapos_panel.png"
release = portal.portal_catalog.getResultValue( release = portal.portal_catalog.getResultValue(
...@@ -8,7 +8,9 @@ release = portal.portal_catalog.getResultValue( ...@@ -8,7 +8,9 @@ release = portal.portal_catalog.getResultValue(
url_string=url_string, url_string=url_string,
) )
if release is not None: if release is not None:
software_product = release.getAggregateValue() software_product = release.getAggregateValue(
image_url = software_product.getDefaultImageAbsoluteUrl() checked_permission='Access contents information')
if software_product is not None:
image_url = software_product.getDefaultImageAbsoluteUrl()
return image_url return image_url
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