mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
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:
parent
fabcfd68ad
commit
a5910f200e
6 changed files with 201 additions and 201 deletions
|
|
@ -110,8 +110,8 @@
|
||||||
<label for="action">Action (permission name):</label>
|
<label for="action">Action (permission name):</label>
|
||||||
<select id="action" name="action" required>
|
<select id="action" name="action" required>
|
||||||
<option value="">Select an action...</option>
|
<option value="">Select an action...</option>
|
||||||
{% for permission_name in sorted_actions %}
|
{% for action_name in sorted_actions %}
|
||||||
<option value="{{ permission_name }}">{{ permission_name }}</option>
|
<option value="{{ action_name }}">{{ action_name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<small>The permission action to check</small>
|
<small>The permission action to check</small>
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@
|
||||||
<label for="action">Action (permission name):</label>
|
<label for="action">Action (permission name):</label>
|
||||||
<select id="action" name="action" required>
|
<select id="action" name="action" required>
|
||||||
<option value="">Select an action...</option>
|
<option value="">Select an action...</option>
|
||||||
{% for permission_name in sorted_actions %}
|
{% for action_name in sorted_actions %}
|
||||||
<option value="{{ permission_name }}">{{ permission_name }}</option>
|
<option value="{{ action_name }}">{{ action_name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<small>The permission action to check</small>
|
<small>The permission action to check</small>
|
||||||
|
|
|
||||||
|
|
@ -486,7 +486,7 @@ async def check_permission_for_resource(
|
||||||
rules_union, all_params = await build_permission_rules_sql(datasette, actor, action)
|
rules_union, all_params = await build_permission_rules_sql(datasette, actor, action)
|
||||||
|
|
||||||
# If no rules (empty SQL), default deny
|
# If no rules (empty SQL), default deny
|
||||||
if not rules_union or rules_union.endswith("WHERE 0"):
|
if not rules_union:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Add parameters for the resource we're checking
|
# Add parameters for the resource we're checking
|
||||||
|
|
|
||||||
BIN
tests/vec.db
BIN
tests/vec.db
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue