diff --git a/tests/test_api_v10.py b/tests/test_api_v10.py index 0e1445c0..766815ed 100644 --- a/tests/test_api_v10.py +++ b/tests/test_api_v10.py @@ -892,6 +892,18 @@ def test_permissions_endpoint(client): assert r.status_code == 200 assert r.json == config['PERMISSIONS'][0:1] + r = client.get('/api/v1.0/permissions?html=1') + assert r.status_code == 200 + assert r.content_type == 'text/html' + assert f"{config['PERMISSIONS'][0]['name']}" in r.text + assert f"{config['PERMISSIONS'][1]['name']}" in r.text + + r = client.get('/api/v1.0/permissions?testcase=greenwave-tests.test1&html=1') + assert r.status_code == 200 + assert r.content_type == 'text/html' + assert f"{config['PERMISSIONS'][0]['name']}" not in r.text + assert f"{config['PERMISSIONS'][1]['name']}" in r.text + def test_config_endpoint_superusers(client): config = { diff --git a/waiverdb/templates/permissions.html b/waiverdb/templates/permissions.html index f43201c0..69597509 100644 --- a/waiverdb/templates/permissions.html +++ b/waiverdb/templates/permissions.html @@ -32,19 +32,28 @@

Description Maintainers Testcases - User groups + Users/Groups - {% for p in permissions %} + {% for p in permissions -%} {{ p["name"] }} {{ p["description"] }} - {{ p["maintainers"] | map("urlize") | join("
") | safe }} - {{ p["testcases"] | join("
") | safe }} - {{ p["groups"] | join("
") | safe }} + {{ p["maintainers"] | map("urlize") | safe | join("
") | safe }} + {{ p["testcases"] | map("replace('-', '‑')") | join("
") | safe }} + + {% if p["groups"] | length > 0 -%} + Groups:
+ {{ p["groups"] | map("replace('-', '‑')") | join("
") | safe }} + {%- endif %} + {% if p["users"] | length > 0 -%} + Users:
+ {{ p["users"] | map("replace('-', '‑')") | join("
") | safe }} + {%- endif %} + - {% endfor %} + {%- endfor %}