← Back to team overview

dhis2-devs team mailing list archive

Re: Using /api/dashboards to assign user groups to dashboards

 

Hi morten ,

      Thanks for the reply :) . Yes , I am okay with using two requests .
Is there any documentation on the sharing api ? regarding its usage?


On Fri, Aug 29, 2014 at 12:22 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
wrote:

> Hi
>
> Are you OK with using two requests for this? we have a sharing API at
> /api/sharing that will do what you want
>
> --
> Morten
>
>
> On Fri, Aug 29, 2014 at 3:10 AM, Sandesh Sukumar Doolipeta <
> sandeshd@xxxxxxxxxxxxxxxx> wrote:
>
>> Hi ,
>>
>>       We are trying to create dashboards using "/api/dashboards" api.
>> While creating the dashboards , we also want to assign user groups to the
>> dashboard.
>>
>> The following is the json being posted ,
>> ======================
>> {
>>     "displayName": "Chad",
>>     "name": "Chad",
>>     "dashboardItems": [
>>         {
>>             "chart": {
>>                 "id": "36041e3ee38"
>>             }
>>         },
>>         {
>>             "chart": {
>>                 "id": "e7f643ca378"
>>             }
>>         }
>>     ],
>>     "publicAccess": "--------",
>>     "access": {
>>         "read": true,
>>         "manage": true,
>>         "update": true,
>>         "externalize": true,
>>         "write": true,
>>         "delete": true
>>     },
>>     "externalAccess": false,
>>     "userGroupAccesses": [
>>       {
>>             "userGroup": {
>>                 "id": "aede79b3fbf"
>>             }
>>         }
>> ],
>>     "id": "abfd69cb586"
>> }
>> ==================
>>
>>  Though the above json , creates the dashboard , it does not assign the
>> user group to it.
>>
>>  When I looked into the code ,
>>
>>   I saw that , HibernateGenericStore.java is a work in progress ,
>>
>> ==========
>>
>>   // TODO we might want to allow setting sharing props on save, but for
>> now we null them out
>>             identifiableObject.setPublicAccess( null );
>>             identifiableObject.setUserGroupAccesses( new
>> HashSet<UserGroupAccess>() );
>>
>> ==========
>>
>>
>>      Is there any other way to assign user groups to dashboard ? Am I
>> missing anything ?
>>
>>
>>
>> --
>> *Sandesh Doolipeta**Application Developer*
>> Emailsandeshd@xxxxxxxxxxxxxxxx
>> Telephone9686062727
>> [image: ThoughtWorks] <http://www.thoughtworks.com/>
>>
>
>


-- 
*Sandesh Doolipeta**Application Developer*
Emailsandeshd@xxxxxxxxxxxxxxxx
Telephone9686062727
[image: ThoughtWorks] <http://www.thoughtworks.com/>

Follow ups

References