kopia lustrzana https://github.com/simonw/datasette
Porównaj commity
3 Commity
bf021eeb5d
...
2917609bd1
Autor | SHA1 | Data |
---|---|---|
Ben Welsh | 2917609bd1 | |
Simon Willison | 8f9509f00c | |
Ben Welsh | 912ed9de92 |
|
@ -26,6 +26,7 @@ class IndexView(BaseView):
|
|||
async def get(self, request):
|
||||
as_format = request.url_vars["format"]
|
||||
await self.ds.ensure_permissions(request.actor, ["view-instance"])
|
||||
metadata = (self.ds.metadata("databases") or {})
|
||||
databases = []
|
||||
for name, db in self.ds.databases.items():
|
||||
database_visible, database_private = await self.ds.check_visibility(
|
||||
|
@ -124,6 +125,7 @@ class IndexView(BaseView):
|
|||
"hidden_tables_count": len(hidden_tables),
|
||||
"views_count": len(views),
|
||||
"private": database_private,
|
||||
"metadata": metadata.get(name, {}),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -386,7 +386,7 @@ This is useful when you need to check multiple permissions at once. For example,
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
await self.ds.ensure_permissions(
|
||||
await datasette.ensure_permissions(
|
||||
request.actor,
|
||||
[
|
||||
("view-table", (database, table)),
|
||||
|
@ -420,7 +420,7 @@ This example checks if the user can access a specific table, and sets ``private`
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
visible, private = await self.ds.check_visibility(
|
||||
visible, private = await datasette.check_visibility(
|
||||
request.actor,
|
||||
action="view-table",
|
||||
resource=(database, table),
|
||||
|
@ -430,7 +430,7 @@ The following example runs three checks in a row, similar to :ref:`datasette_ens
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
visible, private = await self.ds.check_visibility(
|
||||
visible, private = await datasette.check_visibility(
|
||||
request.actor,
|
||||
permissions=[
|
||||
("view-table", (database, table)),
|
||||
|
|
Ładowanie…
Reference in New Issue