← Back to team overview

dhis2-devs team mailing list archive

Using /api/dashboards to assign user groups to dashboards

 

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/>

Follow ups