Skip to content

Commit 707dfba

Browse files
committed
Fix users export
1 parent 99d58b0 commit 707dfba

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sonar/users.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
_GROUPS_API_SC = "users/groups"
4444

45-
SETTABLE_PROPERTIES = ("login", "name", "scmAccounts", "email", "groups", "local")
45+
SETTABLE_PROPERTIES = ("login", "name", "email", "groups", "scmAccounts", "local")
4646
USER_API = "v2/users-management/users"
4747

4848

@@ -448,7 +448,8 @@ def to_json(self, export_settings: types.ConfigSettings) -> types.ObjectJsonRepr
448448
json_data.pop("local")
449449
for key in "sonarQubeLastConnectionDate", "externalLogin", "externalProvider", "id", "managed":
450450
json_data.pop(key, None)
451-
return util.filter_export(json_data, SETTABLE_PROPERTIES, export_settings.get("FULL_EXPORT", False))
451+
json_data = util.filter_export(json_data, SETTABLE_PROPERTIES, export_settings.get("FULL_EXPORT", False))
452+
return convert_user_json(json_data)
452453

453454

454455
def search(endpoint: pf.Platform, params: types.ApiParams = None) -> dict[str, User]:
@@ -571,7 +572,10 @@ def exists(endpoint: pf.Platform, login: str) -> bool:
571572

572573

573574
def convert_user_json(old_json: dict[str, Any]) -> dict[str, Any]:
574-
return util.order_dict(old_json, ["name", "email", "groups", "scmAccounts", "local"])
575+
for k in "groups", "scmAccounts":
576+
if k in old_json:
577+
old_json[k] = util.csv_to_list(old_json[k])
578+
return util.order_dict(old_json, SETTABLE_PROPERTIES)
575579

576580

577581
def convert_users_json(old_json: dict[str, Any]) -> dict[str, Any]:

0 commit comments

Comments
 (0)