How to add users and mongodb charts sources dynamically

Hi,

I have collections based on the user, each users data I have different collection, so whenever users created I need copy all the Stadrad Dashboard and point to the collection belongs to that users.

So want some like below

I have some db called AreadDB and this has collections based on the users.

AreadDB

         adminuser 

         user1

         user2

         user3

         user4

          ....... 

I have default dashboard created by adminuser, dashboards are simple like show numbers of action by user, number of assets he has.

So whenever new user is on boarded, some backed code is creating user account(usr1) using chart-cli in MongoDB chart and also creating new collections.

So Data of that user is going and it will be written to user1 collections . Now when user1 logs in he should be able to see only that data from user1 collections and the default dashboards.

is there a this kind of facility to do that in mongoDB chart to support this kind of features ?

Hi @Great_Info -

Great question! Right now we don’t have any API to programmatically create dashboards and charts. This is something we are looking at doing in a few months.

Since you’re using the on-prem version of Charts, you do have a bit more flexibility in that you can write documents into the metadata database collections which represent things like dashboards and charts. It’s actually pretty easy to duplicate dashboards and charts - you just need to make sure each has a unique ID, the IDs are linked correctly and the dashboard owner is set to a valid user id.

However it probably isn’t practical to create users or data sources programmatically, since these are spread across multiple collections and have sensitive detail (passwords and URIs) encrypted.

So - if you are able to create the dashboard and data source manually, it should be feasible for you to write a script that generates/duplicates dashboards and charts for each user.

HTH
Tom

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.