← Back to team overview

dhis2-users team mailing list archive

Re: [Dhis2-devs] Adding an Org Unit for Data Capture to User from back end

 

Hi Laura,

OK, but in your mail you indicated you were trying to change "Org Unit for
Data Capture and Analysis" which corresponds to "usermembersip", which I
think is the latter, which controls where the user can enter data. The
"userdatavieworgunits" corresponds to the level where users can actually
view data. If it is not set, the user can view everything.

The better way to do this would be to GET "http://yourserver/api/users/UID";
where UID is the uid of the user you need to change. For instance...

<organisationUnits>
<organisationUnit id="ImspTQPwCqd" name="Sierra Leone" code="OU_525" created
="2012-11-13T11:20:53.028+0000" lastUpdated="2015-04-24T09:21:00.090+0000"
href="https://apps.dhis2.org/demo/api/organisationUnits/ImspTQPwCqd"/>
</organisationUnits>

of this user  on the demo site
<https://apps.dhis2.org/demo/api/users/ec7FaM7xdqR> could be changed to
what it needs to be with a POST or PATCH, described here in the docs
<https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s09.html#d5e742>.

This would ensure you do not corrupt the database tables and would not
require you to refresh the cache.

Regards,
Jason


On Tue, Aug 25, 2015 at 7:17 PM, Laura E. Lincks <
laura.lincks@xxxxxxxxxxxxxxxxx> wrote:

> Thanks, Jason.
>
> Yes, the front end is best, but sometimes mistakes happen and we can't do
> it through the front end.
>
> It
> ​appears
> that *userdatavieworgunits *is the table which stores the *Org Units
> assigned under Data output and analysis organisation units* and
> *usermembership *stores *Org Units under Data capture and maintenance
> organisation units. *
>
> My immediate interest is with the former.
>
> ​I'll try clearing the cache.​
>
>
> *Laura E. Lincks*
> Database Manager/Developer
> ICAP - Columbia University
> Mailman School of Public Health
> 60 Haven Ave, Floor B1
> New York, NY 10032
> Tel: 212 304 7132
>
> On Tue, Aug 25, 2015 at 1:11 PM, Jason Pickering <
> jason.p.pickering@xxxxxxxxx> wrote:
>
>> Hi Laura,
>> Be sure to clear the server cache if you perform and direct manipulation
>> of the database tables (Administration->Cache statistics and then "Clear
>> cache") . The recommended way of doing this would be to use the API instead
>> of manipulating these tables directly.
>> However, the "userdatavieworgunits" is not the table which controls
>> which orgunit a user is assigned to, but rather "usermembership".
>>
>> Regards,
>> Jason
>>
>> On Tue, Aug 25, 2015, 17:31 Laura E. Lincks <
>> laura.lincks@xxxxxxxxxxxxxxxxx> wrote:
>>
>>> I'm trying to re-assign an Org Unit for Data Capture and Analysis to a
>>> user from the Postgres backend.
>>>
>>> I see data stored in the userdatavieworgunits table. I can insert a row
>>> into the table and see my results when selecting from the table but the
>>> changes don't affect what I see in the front end or the web api for the
>>> user. The information there does not change.
>>>
>>> Any tips on what I might be missing? Thanks.
>>>
>>> *Laura E. Lincks*
>>> Database Manager/Developer
>>> ICAP - Columbia University
>>> Mailman School of Public Health
>>> 60 Haven Ave, Floor B1
>>> New York, NY 10032
>>> Tel: 212 304 7132
>>> _______________________________________________
>>> 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
>>>
>>
>


-- 
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+46764147049

References