mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
debug-menu permission, closes #1068
Also added tests for navigation menu logic.
This commit is contained in:
parent
9f0987cb57
commit
222f79bb4c
6 changed files with 58 additions and 4 deletions
|
|
@ -3,7 +3,10 @@ from datasette import hookimpl
|
|||
|
||||
@hookimpl
|
||||
def menu_links(datasette, actor):
|
||||
if actor and actor.get("id") == "root":
|
||||
async def inner():
|
||||
if not await datasette.permission_allowed(actor, "debug-menu"):
|
||||
return []
|
||||
|
||||
return [
|
||||
{"href": datasette.urls.path("/-/databases"), "label": "Databases"},
|
||||
{
|
||||
|
|
@ -38,3 +41,5 @@ def menu_links(datasette, actor):
|
|||
{"href": datasette.urls.path("/-/actor"), "label": "Debug actor"},
|
||||
{"href": datasette.urls.path("/-/patterns"), "label": "Pattern portfolio"},
|
||||
]
|
||||
|
||||
return inner
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue