Skip to content

Commit 573e487

Browse files
committed
"username" field added to User response body (duplicates "name" field data).
1 parent ce23dbd commit 573e487

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

genesis_core/tests/functional/restapi/iam/test_users.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ def test_fields_in_me_info_success(
376376
user_has_only_fields = [
377377
"uuid",
378378
"name",
379+
"username",
379380
"description",
380381
"created_at",
381382
"updated_at",

genesis_core/user_api/iam/dm/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ class User(
210210
def get_response_body(self):
211211
return {
212212
"uuid": str(self.uuid),
213-
"name": self.name,
213+
"name": self.name, # deprecated, use "username"
214+
"username": self.name,
214215
"first_name": self.first_name,
215216
"last_name": self.last_name,
216217
"email": self.email,
@@ -944,6 +945,9 @@ def get_response_body(self):
944945
for drop_field in skip_fields:
945946
user.pop(drop_field, None)
946947

948+
# "name" field is deprecated and will be removed, use "username"
949+
user["username"] = user.get("name", None)
950+
947951
organizations = []
948952
for organization in Organization.list_my():
949953
organizations.append(organization.get_storable_snapshot())

0 commit comments

Comments
 (0)