rename visibilities once again
to match with vision in https://wiki.k-space.ee/en/about/inventory Upper case makes more sense, as it is displayed straight to user. Renamed on database-side as well.
This commit is contained in:
@@ -7,5 +7,5 @@
|
||||
|Group|Description|
|
||||
|-----|-----------|
|
||||
|k-space:inventory:audit|Update last time item information confirmed to be accurate|
|
||||
|k-space:inventory:edit|Edit all items that are not keys. Browse items with secret visibility.|
|
||||
|k-space:inventory:edit|Edit all non-key items. Browse items with Protected visibility.|
|
||||
|k-space:inventory:keys|Edit keys|
|
||||
|
@@ -42,7 +42,7 @@ def view_inventory_view(item_id):
|
||||
return abort(404)
|
||||
item_user = item.get("inventory", {}).get("user", {}).get("username", None)
|
||||
if not user:
|
||||
if item["inventory"].get("visibility") not in ["public", "unlisted"]:
|
||||
if item["inventory"].get("visibility") not in ["Featured", "Normal"]:
|
||||
return do_login()
|
||||
template = "inventory_view_public.html"
|
||||
redirect_url = urllib.parse.quote_plus(request.full_path)
|
||||
@@ -129,7 +129,7 @@ class InventoryForm(Form):
|
||||
owner = FormField(MemberForm, label="Owner")
|
||||
user = FormField(MemberForm, label="Current User")
|
||||
usable = BooleanField("Usable")
|
||||
visibility = SelectField("Visibility", choices=['public', 'unlisted', 'secret', 'archived'], default='unlisted')
|
||||
visibility = SelectField("Visibility", choices=['Normal', 'Featured', 'Protected', 'Archived'], default='Normal')
|
||||
|
||||
class HardwareForm(Form):
|
||||
serial = StringField("Serial Number")
|
||||
@@ -435,7 +435,7 @@ def view_inventory(slug=None):
|
||||
login_user = read_user()
|
||||
|
||||
if not login_user:
|
||||
q.update({"inventory.visibility": {"$eq": "public"}})
|
||||
q.update({"inventory.visibility": {"$eq": "Featured"}})
|
||||
template = "inventory_public.html"
|
||||
public_view = True
|
||||
else:
|
||||
@@ -443,9 +443,9 @@ def view_inventory(slug=None):
|
||||
fields.append(("inventory.user.username", "User", str))
|
||||
can_audit = "k-space:inventory:audit" in login_user.get("groups", [])
|
||||
can_edit_all = "k-space:inventory:edit" in login_user.get("groups", [])
|
||||
v = ["public", "unlisted"]
|
||||
v = ["Featured", "Normal"]
|
||||
if can_edit_all:
|
||||
v.append("secret")
|
||||
v.append("Protected")
|
||||
q.update({
|
||||
"$or": [
|
||||
{"inventory.visibility": {"$in": v}},
|
||||
|
Reference in New Issue
Block a user