Adding an Org Unit for Data Capture to User from back end

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

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@icap.columbia.edu 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@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

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…

of this user on the demo site could be changed to what it needs to be with a POST or PATCH, described here in the docs.

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@icap.columbia.edu 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@gmail.com 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@icap.columbia.edu 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@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

Great.

If you do not have a need to specify the level at which the user should be able to view data, you should simply leave it blank.

Regards,

Jason

···

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:28 PM, Jason Pickering jason.p.pickering@gmail.com wrote:

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…

of this user on the demo site could be changed to what it needs to be with a POST or PATCH, described here in the docs.

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@icap.columbia.edu 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.​

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

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@gmail.com 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@icap.columbia.edu 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@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049