mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
adfcec51d6
commit
c41278b46f
8 changed files with 61 additions and 4 deletions
|
|
@ -141,6 +141,11 @@ SETTINGS = (
|
|||
True,
|
||||
"Allow users to create and use signed API tokens",
|
||||
),
|
||||
Setting(
|
||||
"default_allow_sql",
|
||||
True,
|
||||
"Allow anyone to run arbitrary SQL queries",
|
||||
),
|
||||
Setting(
|
||||
"max_signed_tokens_ttl",
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -69,9 +69,15 @@ def permission_allowed_default(datasette, actor, action, resource):
|
|||
return result
|
||||
|
||||
# Check custom permissions: blocks
|
||||
return await _resolve_metadata_permissions_blocks(
|
||||
result = await _resolve_metadata_permissions_blocks(
|
||||
datasette, actor, action, resource
|
||||
)
|
||||
if result is not None:
|
||||
return result
|
||||
|
||||
# --setting default_allow_sql
|
||||
if action == "execute-sql" and not datasette.setting("default_allow_sql"):
|
||||
return False
|
||||
|
||||
return inner
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue