Commit 51d20402 authored by Daniele Venzano's avatar Daniele Venzano
Browse files

By default guest users do not see any ZApp in the Shop. the new attribute...

By default guest users do not see any ZApp in the Shop. the new attribute 'guest_access' in the manifest file can be set to true to make a particular ZApp accessible.
parent 8e029188
Pipeline #4643 passed with stages
in 2 minutes and 49 seconds
......@@ -125,7 +125,8 @@ The ``manifest.json`` file drives the ZApp Shop. Its format is as follows::
"type": "string",
"default": "./my-tf-app/"
"guest_access": true
"category": "TensorFlow",
......@@ -154,6 +155,7 @@ For each ZApp:
* description : the name of the json file with the Zoe description
* readable_descr : the name of the markdown file containing user documentation for the ZApp
* parameters : a list of parameters the user can set to tune the ZApp before starting it
* guest_access (optional) : if true the ZApp is visible to guest users, default is false
......@@ -39,7 +39,7 @@ class ZAppShopHomeWeb(ZoeRequestHandler):
if uid is None:
return self.redirect(self.get_argument('next', u'/login'))
zapps = zapp_shop.zshop_list_apps()
zapps = zapp_shop.zshop_list_apps(role)
template_vars = {
"uid": uid,
......@@ -58,6 +58,10 @@ class ZApp:
self.zoe_description = self.parse_json_description()
self.parameters = []
if 'guest_access' in zapp:
self.guest_access = zapp['guest_access']
self.guest_access = False
def parse_parameters(self, zapp_manifest):
"""Translates the parameters from the manifest into objects."""
......@@ -74,7 +78,7 @@ class ZApp:
return json.load(open(os.path.join(get_conf().zapp_shop_path,, self.json_file), 'r'))
def zshop_list_apps():
def zshop_list_apps(role):
"""List the ZApp repos."""
dirs = [d for d in os.listdir(get_conf().zapp_shop_path) if os.path.isdir(os.path.join(get_conf().zapp_shop_path, d)) and os.path.exists(os.path.join(get_conf().zapp_shop_path, d, "manifest.json"))]
......@@ -84,6 +88,8 @@ def zshop_list_apps():
zapp_cat = {}
for zapp in zapps:
if role == 'guest' and not zapp.guest_access:
if zapp.category in zapp_cat:
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