Code cleanup: rename variables, remove WHERE 0 check, cleanup files, refs #2528

- Rename permission_name to action_name in debug templates for consistency
- Remove confusing WHERE 0 check from check_permission_for_resource()
- Rename tests/test_special.py to tests/test_search_tables.py
- Remove tests/vec.db that shouldn't have been committed
This commit is contained in:
Simon Willison 2025-10-25 09:50:21 -07:00
commit a5910f200e
6 changed files with 201 additions and 201 deletions

View file

@ -110,8 +110,8 @@
<label for="action">Action (permission name):</label>
<select id="action" name="action" required>
<option value="">Select an action...</option>
{% for permission_name in sorted_actions %}
<option value="{{ permission_name }}">{{ permission_name }}</option>
{% for action_name in sorted_actions %}
<option value="{{ action_name }}">{{ action_name }}</option>
{% endfor %}
</select>
<small>The permission action to check</small>

View file

@ -26,8 +26,8 @@
<label for="action">Action (permission name):</label>
<select id="action" name="action" required>
<option value="">Select an action...</option>
{% for permission_name in sorted_actions %}
<option value="{{ permission_name }}">{{ permission_name }}</option>
{% for action_name in sorted_actions %}
<option value="{{ action_name }}">{{ action_name }}</option>
{% endfor %}
</select>
<small>The permission action to check</small>

View file

@ -486,7 +486,7 @@ async def check_permission_for_resource(
rules_union, all_params = await build_permission_rules_sql(datasette, actor, action)
# If no rules (empty SQL), default deny
if not rules_union or rules_union.endswith("WHERE 0"):
if not rules_union:
return False
# Add parameters for the resource we're checking

Binary file not shown.