mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Permissions SQL API improvements (#2558)
* Neater design for PermissionSQL class, refs #2556 - source is now automatically set to the source plugin - params is optional * PermissionSQL.allow() and PermissionSQL.deny() shortcuts Closes #2556 * Filter out temp database from attached_databases() Refs https://github.com/simonw/datasette/issues/2557#issuecomment-3470510837
This commit is contained in:
parent
5247856bd4
commit
6a71bde37f
14 changed files with 241 additions and 227 deletions
|
|
@ -453,16 +453,12 @@ async def test_execute_sql_requires_view_database():
|
|||
if action == "execute-sql":
|
||||
# Grant execute-sql on the "secret" database
|
||||
return PermissionSQL(
|
||||
source="test_plugin",
|
||||
sql="SELECT 'secret' AS parent, NULL AS child, 1 AS allow, 'can execute sql' AS reason",
|
||||
params={},
|
||||
)
|
||||
elif action == "view-database":
|
||||
# Deny view-database on the "secret" database
|
||||
return PermissionSQL(
|
||||
source="test_plugin",
|
||||
sql="SELECT 'secret' AS parent, NULL AS child, 0 AS allow, 'cannot view db' AS reason",
|
||||
params={},
|
||||
)
|
||||
|
||||
return []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue