← Back to team overview

dhis2-devs team mailing list archive

Re: URGENT: Data capture and Maintenance org units Access

 

Hi Georgi, The other workable option where U dont have direct access to
database is use the DHIS2 WebAPI

Georgi, Since the account is a superuser, you could use the WebAPI to
create a new Superuser and allocate to the Main parent orgunit using the
payloads below:-


For this to work properly (currently) you need to generate an ID
(/api/system/id) and then modify the payload like this:

{
  "id": "generated-id",
  "firstName": "John",
  "surname": "Doe",
  "email": "johndoe@xxxxxxxx",
  "userCredentials": {
    "userInfo": { "id": "generated-id" },
    "username": "johndoe",
    "password": "your-password-123",
    "userRoles": [ {
      "id": "Euq3XfEIEbx"
    } ]
  },
  "organisationUnits": [ {
    "id": "ImspTQPwCqd"
  } ],
  "userGroups": [ {
    "id": "vAvEltyXGbD"
  } ]
}

generated-id should be generated using /api/system/id (WebAPI)

Then, Use Curl to Create the user. Once done, Login and Update your account
as usual using users App

curl -X POST -u user:pass -d @u.json -H "Content-Type:
application/json" http://server/api/24/users





On Mon, Mar 12, 2018 at 8:47 PM, Knut Staring <knutst@xxxxxxxxx> wrote:

> Ok...and you cannot just revert to the dump? Or the dump has the same
> problem?
>
> In any case, since you have a dump which you can experiment with (pls note
> that I have not tested this procedure thoroughly, and you might get more
> than one answer if you have more than one root or more than one superuser):
>
> In any case, you should be able to do this in three steps - first finding
> the root OU and then your user:
>
> 1) SELECT organisationunitid, name FROM organisationunit where parentid is
> null; LET'S SAY THE ANSWER IS 18
> 2) SELECT userid from userrole where name='Superuser'; LET'S SAY THE
> ANSWER IS 32
>
> Given those values, you should be able to do this:
>
> 3) UPDATE usermembership SET organisationunitid = 18 WHERE userinfoid = 32;
>
> On Mon, Mar 12, 2018 at 6:21 PM, Georgi Chakarov <
> georgi@xxxxxxxxxxxxxxxxxxx> wrote:
>
>> We got a database dump.
>>
>>
>>
>> *From:* Knut Staring [mailto:knutst@xxxxxxxxx]
>> *Sent:* Monday, March 12, 2018 7:07 PM
>> *To:* Georgi Chakarov <georgi@xxxxxxxxxxxxxxxxxxx>
>> *Cc:* DHIS 2 developers <dhis2-devs@xxxxxxxxxxxxxxxxxxx>; DHIS 2 Users
>> list <dhis2-users@xxxxxxxxxxxxxxxxxxx>
>> *Subject:* Re: [Dhis2-devs] URGENT: Data capture and Maintenance org
>> units Access
>>
>>
>>
>> Do you have direct access to the database?
>>
>>
>>
>> On Mon, Mar 12, 2018, 17:47 Georgi Chakarov <georgi@xxxxxxxxxxxxxxxxxxx>
>> wrote:
>>
>> Hello all,
>>
>>
>>
>> For some testing purpose, I gave my superuser access to ONE org unit at
>> the lowest level. Now, I and (*all other users*) see only this org unit
>> for all data entry and maintenance apps, which is a bit strange.
>>
>> Does anyone know how do I regain access to the entire org unit tree again?
>>
>>
>>
>>
>>
>>
>>
>>
>> Georgi Chakarov, CIA | georgi@xxxxxxxxxxxxxxxxxxx | +1-647-478-5634 x 104
>> <(647)%20478-5634> | LogicalOutcomes c/o Centre for Social Innovation, 720
>> Bathurst Street, Toronto Canada M5S 2R4
>> <https://maps.google.com/?q=720+Bathurst+Street,+Toronto+Canada+M5S+2R4&entry=gmail&source=g>
>> | *You may unsubscribe from receiving commercial electronic messages
>> from LogicalOutcomes by emailing **info@xxxxxxxxxxxxxxxxxxx*
>> <info@xxxxxxxxxxxxxxxxxxx>
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Knut Staring
>
> Department of Information, Evidence and Research
> World Health Organization, Geneva, Switzerland
> Office: +41 22 791 3683 <+41%2022%20791%2036%2083> Mob1: +33 6 4434 2931
> <+33%206%2044%2034%2029%2031> Mob2: +47 9188 0522
> Skype:     knutstar
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
--
*Stephen Ocaya*
Tel: +256 393 217 892 | Mob: +256774558980
www.stephocay.com
SkypeID: stephocay

References