Users getting de assigned from User Group on modifying Users

We had tried modifying few users which were assigned to some user groups. On modifying, all users in associated user groups are getting de-assigned. Checked the details, the lastUpdated of userGroup is getting updated. Why is users getting de- assigned. Do we have any configuration to avoid this issue?

Hi @Pooja_Deshpande

Welcome to the community!

This is the first time I hear of this issue. Please what is the version of DHIS2 that you are using. Are you able to reproduce this issue in any of the play.dhis2.org instances? If so please share the steps.

What modifications are you making? Please add as much information as possible.

Thanks!

Hi @Gassim
Thank you so much!

We were basically trying to disable the non active users using a script in the backend. The users were disabled, whichever user groups they were associated with got modified. In turn the other users in those user groups which were not even modified by script were de-assigned from the groups. We got to know from users who were not able to use application normally they had lost some permissions. When checked for their roles found that they were not assigned to the respective groups. Haven’t tried the same in play.dhis2.org .
Thanks!

1 Like

Hi @Pooja_Deshpande

Thank you for the clarification. Could it be that the script is causing an unwanted behavior. I believe you are probably using the API in your script. Does the API request target the /users endpoint or another endpoint?

For example, a PATCH request to {instance}/api/40/users/{userID} with "body": "[{\"op\":\"replace\",\"path\":\"/userCredentials/disabled\",\"value\":true}]" will only affect the specific user id and shouldn’t affect anything else.

Is that how the script approaches the issue?