diff --git a/inventory-app/inventory.py b/inventory-app/inventory.py index f95cfa3..af71b26 100644 --- a/inventory-app/inventory.py +++ b/inventory-app/inventory.py @@ -41,11 +41,14 @@ def view_inventory_view(item_id): if not item: return abort(404) item_user = item.get("inventory", {}).get("user", {}).get("username", None) + item_owner = item.get("inventory", {}).get("owner", {}).get("username", None) if not user: if item["inventory"].get("visibility") not in ["public"]: return do_login() template = "inventory_view_public.html" redirect_url = urllib.parse.quote_plus(request.full_path) + elif item["inventory"].get("visibility") == "private" and item_owner != user["username"] and "k-space:inventory:edit" not in user.get("groups", []): + return abort(403) else: can_audit = "k-space:inventory:audit" in user.get("groups", []) can_edit = check_edit_permission(item_id)