From 74f8bb02ad069c7bf1fd334080e94d7022d9a657 Mon Sep 17 00:00:00 2001 From: cirun Date: Wed, 10 Jan 2024 00:14:36 +0100 Subject: [PATCH] add username to the context --- ckan/logic/action/create.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ckan/logic/action/create.py b/ckan/logic/action/create.py index f4354951525..25ad1cfc1aa 100644 --- a/ckan/logic/action/create.py +++ b/ckan/logic/action/create.py @@ -1041,6 +1041,9 @@ def user_create(context: Context, model.repo.commit() if with_apitoken: + if not context['user']: + context["user"] = user.name + # Create apitoken for user. api_token = _get_action("api_token_create")( context, {"user": user.name, "name": "default"}