mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
PluginSQL renamed to PermissionSQL, closes #2524
This commit is contained in:
parent
cf887e0277
commit
5ed57607e5
11 changed files with 84 additions and 81 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional, NamedTuple
|
||||
from typing import Any, Dict, Optional, NamedTuple
|
||||
|
||||
|
||||
class Resource(ABC):
|
||||
|
|
@ -86,6 +86,21 @@ class Action:
|
|||
resource_class: type[Resource]
|
||||
|
||||
|
||||
@dataclass
|
||||
class PermissionSQL:
|
||||
"""
|
||||
A plugin contributes SQL that yields:
|
||||
parent TEXT NULL,
|
||||
child TEXT NULL,
|
||||
allow INTEGER, -- 1 allow, 0 deny
|
||||
reason TEXT
|
||||
"""
|
||||
|
||||
source: str # identifier used for auditing (e.g., plugin name)
|
||||
sql: str # SQL that SELECTs the 4 columns above
|
||||
params: Dict[str, Any] # bound params for the SQL (values only; no ':' prefix)
|
||||
|
||||
|
||||
# This is obsolete, replaced by Action and ResourceType
|
||||
@dataclass
|
||||
class Permission:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue