Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database_actions menu item if user has permission #9

Closed
simonw opened this issue Feb 27, 2024 · 1 comment
Closed

database_actions menu item if user has permission #9

simonw opened this issue Feb 27, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Feb 27, 2024

Using https://docs.datasette.io/en/latest/plugin_hooks.html#database-actions-datasette-actor-database-request

@simonw simonw added the enhancement New feature or request label Feb 27, 2024
@simonw simonw changed the title database_action menu item if user has permission database_actions menu item if user has permission Feb 27, 2024
@simonw
Copy link
Owner Author

simonw commented Feb 27, 2024

This is already implemented:

@hookimpl
def database_actions(datasette, actor, database):
async def inner():
if database != "_internal" and await datasette.permission_allowed(
actor, "datasette-write", default=False
):
return [
{
"href": datasette.urls.path(
"/-/write?"
+ urlencode(
{
"database": database,
}
)
),
"label": "Execute SQL write",
},
]
return inner

@simonw simonw closed this as completed Feb 27, 2024
simonw added a commit that referenced this issue Feb 27, 2024
Refs #1, #6, #7, #8, #9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant