mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Respect existing scope["actor"] if set, closes #854
This commit is contained in:
parent
d2aef9f7ef
commit
6151c25a5a
4 changed files with 22 additions and 1 deletions
|
|
@ -137,6 +137,20 @@ def actor_from_request(datasette, request):
|
|||
return None
|
||||
|
||||
|
||||
@hookimpl
|
||||
def asgi_wrapper():
|
||||
def wrap(app):
|
||||
async def maybe_set_actor_in_scope(scope, recieve, send):
|
||||
if b"_actor_in_scope" in scope["query_string"]:
|
||||
scope = dict(scope, actor={"id": "from-scope"})
|
||||
print(scope)
|
||||
await app(scope, recieve, send)
|
||||
|
||||
return maybe_set_actor_in_scope
|
||||
|
||||
return wrap
|
||||
|
||||
|
||||
@hookimpl
|
||||
def permission_allowed(actor, action):
|
||||
if action == "this_is_allowed":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue