simonw / datasette

@@ -96,7 +96,8 @@
Loading
96 96
        return await self.render(
97 97
            ["permissions_debug.html"],
98 98
            request,
99 -
            {"permission_checks": reversed(self.ds._permission_checks)},
99 +
            # list() avoids error if check is performed during template render:
100 +
            {"permission_checks": list(reversed(self.ds._permission_checks))},
100 101
        )
101 102
102 103

@@ -3,7 +3,10 @@
Loading
3 3
4 4
@hookimpl
5 5
def menu_links(datasette, actor):
6 -
    if actor and actor.get("id") == "root":
6 +
    async def inner():
7 +
        if not await datasette.permission_allowed(actor, "debug-menu"):
8 +
            return []
9 +
7 10
        return [
8 11
            {"href": datasette.urls.path("/-/databases"), "label": "Databases"},
9 12
            {
@@ -38,3 +41,5 @@
Loading
38 41
            {"href": datasette.urls.path("/-/actor"), "label": "Debug actor"},
39 42
            {"href": datasette.urls.path("/-/patterns"), "label": "Pattern portfolio"},
40 43
        ]
44 +
45 +
    return inner

@@ -5,7 +5,7 @@
Loading
5 5
@hookimpl(tryfirst=True)
6 6
def permission_allowed(datasette, actor, action, resource):
7 7
    async def inner():
8 -
        if action == "permissions-debug":
8 +
        if action in ("permissions-debug", "debug-menu"):
9 9
            if actor and actor.get("id") == "root":
10 10
                return True
11 11
        elif action == "view-instance":
Files Coverage
datasette 91.30%
Project Totals (29 files) 91.30%
1
coverage:
2
  status:
3
    project:
4
      default:
5
        informational: true
6
    patch:
7
      default:
8
        informational: true
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading