Modify update user info from pencil icon in keystone v2

When we update the user info from pencil icon in User List,
data doesn't have 'project' attribute.
Therefore, date.pop('project') failed and exception occur.

The v2 API updates user model and default project separately.
And in User List, operator don't need to consider if a user
have a default tenant.
So we should check if data has a 'project' attribute and
if data has no 'project' attribute, it will update only user info.

Change-Id: I979bedeb8ddb15d3f7f171660ec9df4875edb53a
Closes-Bug: #1523343
This commit is contained in:
kenji-ishii 2015-12-07 22:58:58 +09:00 committed by Kenji Ishii
parent 4b5886d276
commit 6beefb3726

View File

@ -354,8 +354,6 @@ def user_update(request, user, **data):
# The v2 API updates user model and default project separately
if VERSIONS.active < 3:
project = data.pop('project')
# Update user details
try:
user = manager.update(user, **data)
@ -364,6 +362,9 @@ def user_update(request, user, **data):
except Exception:
error = exceptions.handle(request, ignore=True)
if "project" in data:
project = data.pop('project')
# Update default tenant
try:
user_update_tenant(request, user, project)