Rename 't' to 'r' in '_r' actor format, refs #1855

pull/1823/merge
Simon Willison 2022-12-12 19:27:34 -08:00
rodzic c5d30b58a1
commit 3e6a208ba3
2 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -202,7 +202,7 @@ def permission_allowed_actor_restrictions(actor, action, resource):
# Or the current table? That's any time the resource is (database, table)
if resource is not None and not isinstance(resource, str) and len(resource) == 2:
database, table = resource
table_allowed = _r.get("t", {}).get(database, {}).get(table)
table_allowed = _r.get("r", {}).get(database, {}).get(table)
# TODO: What should this do for canned queries?
if table_allowed is not None:
assert isinstance(table_allowed, list)

Wyświetl plik

@ -592,16 +592,16 @@ DEF = "USE_DEFAULT"
DEF,
),
({"id": "t", "_r": {"d": {"one": ["es"]}}}, "execute-sql", "one", None, DEF),
# Works at the "t" for table level:
# Works at the "r" for table level:
(
{"id": "t", "_r": {"t": {"one": {"t1": ["vt"]}}}},
{"id": "t", "_r": {"r": {"one": {"t1": ["vt"]}}}},
"view-table",
"one",
"t1",
DEF,
),
(
{"id": "t", "_r": {"t": {"one": {"t1": ["vt"]}}}},
{"id": "t", "_r": {"r": {"one": {"t1": ["vt"]}}}},
"view-table",
"one",
"t2",