mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Implemented view-table, refs #811
This commit is contained in:
parent
b26292a458
commit
9397d71834
4 changed files with 108 additions and 41 deletions
|
|
@ -42,6 +42,21 @@ class DatabaseView(DataView):
|
|||
|
||||
tables = []
|
||||
for table in table_counts:
|
||||
allowed = await self.ds.permission_allowed(
|
||||
request.scope.get("actor"),
|
||||
"view-table",
|
||||
resource_type="table",
|
||||
resource_identifier=(database, table),
|
||||
default=True,
|
||||
)
|
||||
if not allowed:
|
||||
continue
|
||||
private = not await self.ds.permission_allowed(
|
||||
None,
|
||||
"view-table",
|
||||
resource_type="table",
|
||||
resource_identifier=(database, table),
|
||||
)
|
||||
table_columns = await db.table_columns(table)
|
||||
tables.append(
|
||||
{
|
||||
|
|
@ -52,6 +67,7 @@ class DatabaseView(DataView):
|
|||
"hidden": table in hidden_table_names,
|
||||
"fts_table": await db.fts_table(table),
|
||||
"foreign_keys": all_foreign_keys[table],
|
||||
"private": private,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue