Fix setting Primary Project for new user once the project was created
When the project is being created via pressing '+' button at Create User form, it is important to store the reference to it inside the `workflow.object` attribute, otherwise [None, None] value will be returned to the client-side code which will cause appending "null" value to the list of available projects - instead of adding the newly created project name and selecting it as the current value. Change-Id: I10fcb1f2fb51e341b15901d4f014f0e4faca3adf Closes-Bug: #1410129
This commit is contained in:
parent
a69f712d94
commit
3d7b163f87
@ -203,9 +203,11 @@ class WorkflowView(hz_views.ModalBackdropMixin, generic.TemplateView):
|
|||||||
messages.error(request, msg)
|
messages.error(request, msg)
|
||||||
if "HTTP_X_HORIZON_ADD_TO_FIELD" in self.request.META:
|
if "HTTP_X_HORIZON_ADD_TO_FIELD" in self.request.META:
|
||||||
field_id = self.request.META["HTTP_X_HORIZON_ADD_TO_FIELD"]
|
field_id = self.request.META["HTTP_X_HORIZON_ADD_TO_FIELD"]
|
||||||
|
response = http.HttpResponse()
|
||||||
|
if workflow.object:
|
||||||
data = [self.get_object_id(workflow.object),
|
data = [self.get_object_id(workflow.object),
|
||||||
self.get_object_display(workflow.object)]
|
self.get_object_display(workflow.object)]
|
||||||
response = http.HttpResponse(json.dumps(data))
|
response.content = json.dumps(data)
|
||||||
response["X-Horizon-Add-To-Field"] = field_id
|
response["X-Horizon-Add-To-Field"] = field_id
|
||||||
return response
|
return response
|
||||||
next_url = self.request.REQUEST.get(workflow.redirect_param_name, None)
|
next_url = self.request.REQUEST.get(workflow.redirect_param_name, None)
|
||||||
|
@ -404,11 +404,12 @@ class CreateProject(workflows.Workflow):
|
|||||||
domain_id = data['domain_id']
|
domain_id = data['domain_id']
|
||||||
try:
|
try:
|
||||||
desc = data['description']
|
desc = data['description']
|
||||||
return api.keystone.tenant_create(request,
|
self.object = api.keystone.tenant_create(request,
|
||||||
name=data['name'],
|
name=data['name'],
|
||||||
description=desc,
|
description=desc,
|
||||||
enabled=data['enabled'],
|
enabled=data['enabled'],
|
||||||
domain=domain_id)
|
domain=domain_id)
|
||||||
|
return self.object
|
||||||
except Exception:
|
except Exception:
|
||||||
exceptions.handle(request, ignore=True)
|
exceptions.handle(request, ignore=True)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user