Change visibility logic
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -41,14 +41,11 @@ def view_inventory_view(item_id):
|
|||||||
if not item:
|
if not item:
|
||||||
return abort(404)
|
return abort(404)
|
||||||
item_user = item.get("inventory", {}).get("user", {}).get("username", None)
|
item_user = item.get("inventory", {}).get("user", {}).get("username", None)
|
||||||
item_owner = item.get("inventory", {}).get("owner", {}).get("username", None)
|
|
||||||
if not user:
|
if not user:
|
||||||
if item["inventory"].get("visibility") not in ["public"]:
|
if item["inventory"].get("visibility") not in ["public", "unlisted"]:
|
||||||
return do_login()
|
return do_login()
|
||||||
template = "inventory_view_public.html"
|
template = "inventory_view_public.html"
|
||||||
redirect_url = urllib.parse.quote_plus(request.full_path)
|
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:
|
else:
|
||||||
can_audit = "k-space:inventory:audit" in user.get("groups", [])
|
can_audit = "k-space:inventory:audit" in user.get("groups", [])
|
||||||
can_edit = check_edit_permission(item_id)
|
can_edit = check_edit_permission(item_id)
|
||||||
|
Reference in New Issue
Block a user