mirror of
https://github.com/simonw/datasette.git
synced 2026-06-05 08:37:00 +02:00
Three changes:
1. Rewrite test_utils_permissions.py to exercise production code paths
(allowed_resources / allowed) instead of the test-only
resolve_permissions_from_catalog function. Tests now register plugins
via ds.pm.register and call the real Datasette methods.
2. Remove resolve_permissions_from_catalog, resolve_permissions_with_candidates,
and build_rules_union from datasette/utils/permissions.py. These were
only used by tests and implemented the cascading logic a third time,
independently of the two production implementations.
3. Fix bug in gather_permission_sql_from_hooks where empty params dicts
({}) would cause framework-injected params (:actor_id, :actor, :action)
to be silently lost. The expression `params = permission_sql.params or {}`
creates a new dict when params is {} (falsy), so setdefault writes to a
throwaway dict. Fixed by explicitly checking `is None`.
https://claude.ai/code/session_013EkyroQKPhcjdMbpHc9g4X
|
||
|---|---|---|
| .. | ||
| default_permissions | ||
| publish | ||
| static | ||
| templates | ||
| utils | ||
| views | ||
| __init__.py | ||
| __main__.py | ||
| actor_auth_cookie.py | ||
| app.py | ||
| blob_renderer.py | ||
| cli.py | ||
| database.py | ||
| default_actions.py | ||
| default_magic_parameters.py | ||
| default_menu_links.py | ||
| events.py | ||
| facets.py | ||
| filters.py | ||
| forbidden.py | ||
| handle_exception.py | ||
| hookspecs.py | ||
| inspect.py | ||
| permissions.py | ||
| plugins.py | ||
| renderer.py | ||
| resources.py | ||
| sql_functions.py | ||
| tracer.py | ||
| url_builder.py | ||
| version.py | ||