diff --git a/services_backend/routes/button.py b/services_backend/routes/button.py index 1660273..7c01331 100644 --- a/services_backend/routes/button.py +++ b/services_backend/routes/button.py @@ -131,14 +131,13 @@ def get_buttons( "name": button.name, "order": button.order, "type": button.type, + "link": button.link if user_scopes.issuperset(button.required_scopes) else None, "view": view.value, "required_scopes": button.required_scopes, "optional_scopes": button.optional_scopes, } if view == ButtonView.ACTIVE: to_add["scopes"] = list(scopes) - if user_scopes.issuperset(button.required_scopes): - to_add["link"] = button.link result["buttons"].append(to_add) return result @@ -181,14 +180,14 @@ def get_button( "name": button.name, "order": button.order, "type": button.type, + "link": button.link if user_scopes.issuperset(button.required_scopes) else None, "view": view.value, - "required_scopes": button.required_scopes, + "required_scopes": button. + required_scopes, "optional_scopes": button.optional_scopes, } if view == ButtonView.ACTIVE: result["scopes"] = list(scopes) - if user_scopes.issuperset(button.required_scopes): - result["link"] = button.link return result @@ -308,7 +307,7 @@ def get_service( "id": button.id, "icon": button.icon, "name": button.name, - "link": button.link, + "link": button.link if user_scopes.issuperset(button.required_scopes) else None, "order": button.order, "type": button.type, "view": view.value, diff --git a/services_backend/routes/category.py b/services_backend/routes/category.py index c924938..203b38a 100644 --- a/services_backend/routes/category.py +++ b/services_backend/routes/category.py @@ -119,7 +119,7 @@ def get_categories( "id": button.id, "icon": button.icon, "name": button.name, - "link": button.link, + "link": button.link if user_scopes.issuperset(button.required_scopes) else None, "order": button.order, "type": button.type, "view": view.value,