Non Owner Reference Error Message

Hi Dear Community.
I have tried to update user password using postman, by this:


It works like a charm on our Test instanse (2.40.3). Also I successfully tested it on Play (2.39)
But with our PROD instance I get this error message:

Any help will be appriciated.

P.S. This is very important for us. Currently we have more than 500 users with Passwords we need to update. So we gonna use csv file (id,code) with Postmun Runer to loop PATCH request in Postman (for Bulk Password updating)

Hi
Since these are working on other instances and in an instance with the same version as yours, would you double check that the user making the update actually has the same authorities as the users in the other system?

Additionally, are you going to make the password value the same for all users? BTW, PM has a random function (random name, country, city, number…etc)

Thanks!

Hi,

  1. users have the same authority.
  2. I am going to make different password values.
  3. Our PROD instance is 2.37.9.1 (so it slightly differs from Play 2.39). Maybe this is the cause…
    Anyway TY for trying to help

Hi @m.siusko

Maybe that’s why it’s not working in 2.37? Maybe track network requests in that version when you update a password and see if there are any changes? Are you able to update the password from the UI then maybe use DevTools → Network?

I hope the suggestion helps.

1 Like

Dear @Gassim , TY for your reply,

In UI I can update passwords easily.
But I want to LOOP Postman PATCH request (using CSV template with different passwords for each user ID) to be able to BULK update user passwords.

If there is more simple way to BULK update user passwords (with different passwords values) in DHIS2, I will appriciate if you be so kind to share it with me…

Hi @m.siusko

Okay, what I meant is that you check the network request sent in the DevTools when you update the password using the UI and compare it with the network request being sent using PM. :slight_smile:


I understand your situation. Maybe another approach would be to use the System Settings to force users to update their passwords:


But I understand that this needs to be done ‘now’ rather than wait three months (the minimum period).

Another suggestion is to try using Pgadmin and change the passwords using SQL but the passwords need to be inserted the same way the system does (hashed…etc); however, I think your approach seems good and maybe a better idea rather than touching the database.

Does the API request work before ‘looping’ i.e. one change at a time but not when looping? What’s the issue that you see when using PM Runner?

Hi! I solved the task. Maybe it will help somebody. (Big thanks to @Ulanbek for the ideas). Here are the steps I performed:

  1. Got the list of users for a specific OU in Postman (users whose passwords I wanted to change):
    GET https://{{URLPROD}}/api/users.json?fields=*&paging=false&filter=organisationUnits.path:like:{{OUID}}

  2. Then I opened the JSON file in VS Code and replaced all “selfRegistered”: false with “password”: “yourPassword1”, “yourPassword2”, etc.

  3. To avoid replacing it manually, I used a simple JS script that searched each string containing “selfRegistered” and replaced them with a random password from an array [‘password1’, ‘password2’, ‘password3’] using the replace() method.

  4. And finally I used the modified json file in the Import/Export APP to BULK update user passwords

1 Like

You could simple remove lastUpdatedBy string or recreate a user with given UID, which used as lastUpdatedBy, in the new dhis instance.

Normally if you are about to replicate something just make sure you have the same users in the new instance as well

Good luck

1 Like