mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Cascade for restricted token view-table/view-database/view-instance operations (#2154)
Closes #2102 * Permission is now a dataclass, not a namedtuple - refs https://github.com/simonw/datasette/pull/2154/#discussion_r1308087800 * datasette.get_permission() method
This commit is contained in:
parent
a1f3d75a52
commit
50da908213
8 changed files with 427 additions and 50 deletions
|
|
@ -280,7 +280,7 @@ All databases are listed, irrespective of user permissions.
|
|||
|
||||
Property exposing a dictionary of permissions that have been registered using the :ref:`plugin_register_permissions` plugin hook.
|
||||
|
||||
The dictionary keys are the permission names - e.g. ``view-instance`` - and the values are ``Permission()`` named tuples describing the permission. Here is a :ref:`description of that tuple <plugin_register_permissions>`.
|
||||
The dictionary keys are the permission names - e.g. ``view-instance`` - and the values are ``Permission()`` objects describing the permission. Here is a :ref:`description of that object <plugin_register_permissions>`.
|
||||
|
||||
.. _datasette_plugin_config:
|
||||
|
||||
|
|
@ -469,6 +469,16 @@ The following example creates a token that can access ``view-instance`` and ``vi
|
|||
},
|
||||
)
|
||||
|
||||
.. _datasette_get_permission:
|
||||
|
||||
.get_permission(name_or_abbr)
|
||||
-----------------------------
|
||||
|
||||
``name_or_abbr`` - string
|
||||
The name or abbreviation of the permission to look up, e.g. ``view-table`` or ``vt``.
|
||||
|
||||
Returns a :ref:`Permission object <plugin_register_permissions>` representing the permission, or raises a ``KeyError`` if one is not found.
|
||||
|
||||
.. _datasette_get_database:
|
||||
|
||||
.get_database(name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue