mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fix bug with breadcrumbs and request=None, closes #1849
This commit is contained in:
parent
c7dd76c262
commit
df7bf0b2fc
2 changed files with 15 additions and 3 deletions
|
|
@ -633,15 +633,18 @@ class Datasette:
|
|||
|
||||
async def _crumb_items(self, request, table=None, database=None):
|
||||
crumbs = []
|
||||
actor = None
|
||||
if request:
|
||||
actor = request.actor
|
||||
# Top-level link
|
||||
if await self.permission_allowed(
|
||||
actor=request.actor, action="view-instance", default=True
|
||||
actor=actor, action="view-instance", default=True
|
||||
):
|
||||
crumbs.append({"href": self.urls.instance(), "label": "home"})
|
||||
# Database link
|
||||
if database:
|
||||
if await self.permission_allowed(
|
||||
actor=request.actor,
|
||||
actor=actor,
|
||||
action="view-database",
|
||||
resource=database,
|
||||
default=True,
|
||||
|
|
@ -656,7 +659,7 @@ class Datasette:
|
|||
if table:
|
||||
assert database, "table= requires database="
|
||||
if await self.permission_allowed(
|
||||
actor=request.actor,
|
||||
actor=actor,
|
||||
action="view-table",
|
||||
resource=(database, table),
|
||||
default=True,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue