diff --git a/package.json b/package.json index a4ee83b..4f7e634 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "user-extended-app", "description": "DHIS2 Extended User app", - "version": "1.2.0", + "version": "1.2.1", "license": "GPL-3.0", "author": "EyeSeeTea team", "homepage": ".", diff --git a/src/data/repositories/UserD2ApiRepository.ts b/src/data/repositories/UserD2ApiRepository.ts index edbed31..e8faccf 100644 --- a/src/data/repositories/UserD2ApiRepository.ts +++ b/src/data/repositories/UserD2ApiRepository.ts @@ -130,6 +130,9 @@ export class UserD2ApiRepository implements UserRepository { skype: user?.skype, telegram: user?.telegram, twitter: user?.twitter, + userRoles: user?.userCredentials.userRoles, + username: user?.userCredentials.username, + disabled: user?.userCredentials.disabled, userCredentials: { ...existingUser.userCredentials, disabled: user?.userCredentials.disabled, diff --git a/src/legacy/List/List.component.js b/src/legacy/List/List.component.js index 7ddbc64..a82a4b3 100644 --- a/src/legacy/List/List.component.js +++ b/src/legacy/List/List.component.js @@ -159,9 +159,7 @@ export class ListHybrid extends React.Component { const newValue = action === "disable"; const response = await updateUsers(this.context.d2, users, user => { if (user?.userCredentials?.disabled !== newValue) { - return set("userCredentials.disabled", newValue, user); - } else if (user?.disabled !== newValue) { - return set("disabled", newValue, user); + return set("disabled", newValue, set("userCredentials.disabled", newValue, user)); } else { return null; } diff --git a/src/legacy/models/userHelpers.js b/src/legacy/models/userHelpers.js index 6465856..74b3e26 100644 --- a/src/legacy/models/userHelpers.js +++ b/src/legacy/models/userHelpers.js @@ -18,6 +18,8 @@ const propertiesIgnoredOnImport = ["id", "created", "lastUpdated", "lastLogin"]; const userCredentialsFields = ["username", "password", "userRoles", "disabled", "openId"]; +const user238MissingFields = ["username", "userRoles", "disabled"]; + const columnNameFromPropertyMapping = { id: "ID", username: "Username", @@ -317,6 +319,7 @@ function getUserPayloadFromPlainAttributes(baseUser, userFields) { id: (baseUser.userCredentials && baseUser.userCredentials.id) || generateUid(), userInfo: { id: userRoot.id }, }, + ...clean(_(userFields).pick(user238MissingFields).value()), }; } diff --git a/src/webapp/components/user-list-table/UserListTable.tsx b/src/webapp/components/user-list-table/UserListTable.tsx index 41dee31..46c4edc 100644 --- a/src/webapp/components/user-list-table/UserListTable.tsx +++ b/src/webapp/components/user-list-table/UserListTable.tsx @@ -229,10 +229,11 @@ export const UserListTable: React.FC = ({ pageSizeInitialValue: 25, }, searchBoxLabel: i18n.t("Search by name or username..."), - onActionButtonClick: () => navigate("/new"), + // FIXME: Disabled as long as user creation via /new does not work. + // onActionButtonClick: () => navigate("/new"), onReorderColumns, }; - }, [openSettings, enableReplicate, editUsers, onReorderColumns, reload, navigate]); + }, [openSettings, enableReplicate, editUsers, onReorderColumns, reload]); const refreshRows = useCallback( async (