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
|
|
@ -1,6 +1,16 @@
|
|||
import collections
|
||||
from dataclasses import dataclass, fields
|
||||
from typing import Optional
|
||||
|
||||
Permission = collections.namedtuple(
|
||||
"Permission",
|
||||
("name", "abbr", "description", "takes_database", "takes_resource", "default"),
|
||||
)
|
||||
|
||||
@dataclass
|
||||
class Permission:
|
||||
name: str
|
||||
abbr: Optional[str]
|
||||
description: Optional[str]
|
||||
takes_database: bool
|
||||
takes_resource: bool
|
||||
default: bool
|
||||
# This is deliberately undocumented: it's considered an internal
|
||||
# implementation detail for view-table/view-database and should
|
||||
# not be used by plugins as it may change in the future.
|
||||
implies_can_view: bool = False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue