← Back to team overview

dhis2-users team mailing list archive

Re: [Dhis2-devs] Sharing DEs and other objects via the API

 

Ok, the problem with the approach mentioned there is that it can only
change the sharing for 1 object at a time (the sharing API).

If you want to create/update a large number of objects including sharing,
you will need to add the sharing to the object payload itself.

Since you are on 2.22, this means you have to use the old importer.. and
set sharing=true when doing the import.

-- 
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Wed, Jul 27, 2016 at 3:22 PM, David Muturi <dnmuturi@xxxxxxxxx> wrote:

> Hi Morten,
> This is on version 2.22, I am looking at the guide here
> http://dhis2.github.io/dhis2-docs/2.22/en/developer/html/dhis2_developer_manual_full.html
>
>  rgds
> David
>
> 2016-07-27 16:12 GMT+03:00 Morten Olav Hansen <morten@xxxxxxxxx>:
>
>> Hi
>>
>> What version of DHIS2 are you on?
>>
>> To share objects with a N number of user they would have to be put into
>> their own user group, then all you have to do is to add:
>>
>> "userGroupAccesses": [
>>   {"userGroup": {"id": "user-group-ID"}, "access": "rw------" }
>> ]
>>
>> To the objects
>>
>> (assuming read-write, r------- if not)
>>
>> This would have to be sent to /api/23/metadata or /api/24/metadata
>> (depending on which version you are on)
>>
>> --
>> Morten Olav Hansen
>> Senior Engineer, DHIS 2
>> University of Oslo
>> http://www.dhis2.org
>>
>> On Wed, Jul 27, 2016 at 3:03 PM, David Muturi <dnmuturi@xxxxxxxxx> wrote:
>>
>>> Hi Dhis2 Team,
>>> I am trying to share a large number of data elements among st numerous
>>> user groups and it would be easier to bootstrap this via a script through
>>> the API, I am looking through the documentation and cannot find proper
>>> Payload syntax of sharing DES to multiple users. Any one who has done this
>>> before or atleast knows the syntax?
>>> rgds
>>> David
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>

References