Forum Discussion

DeCha's avatar
DeCha
Data Storage
07-30-2024
Solved

How to fetch a list of accessible dashboards for each user?

I'm looking to do something simple.  From my application, fetch a list of dashboards our logged in user has access to in Sisense. Is there any way to cleanly do this via API without using the acc...
  • AssafHanina's avatar
    AssafHanina
    08-02-2024

    Hey DeCha and HamzaJ,

    In addition to the suggested plugin by Ravid_PaldiTeam , if you would like a dashboard that displays the list of dashboards along with the users/groups they are shared with, you can build it using the following APIs(Using Admin Token):

    1. GET /api/v1/dashboards/admin 
      - Fetches the list of all dashboards
      - shared object for each dashboard, which includes the user/group ID with whom the dashboard is shared. 
    2. GET /api/v1/users 
      - Retrieves all users list 
      - Retrieves user role id 
      - Object Groups - require to parse as it's contain a list of Group id's which the users is belongs to. 
    3. GET /api/roles - Fetches the list of all roles.
    4. GET /api/v1/groups - Fetches the list of all groups.

    Possible Implementation:
    create CSV tables or Tables in the database (in case it's API base with Scheduler) as the following structure and build a data model on top of it. 

    1. Create Users Dimension Table and Merge Users info with Roles Info. 
    2. Create Groups Dimension Table.
    3. Create Users Group Table, which is a Union ALL of the following sub tables: 
      - Parse the Object groups from GET /api/v1/users - it will provide the list of users and Groups.
      - Everyone Group - is a sisense default groups which means all users belong to the same tenant. 
        Dashboard shared with Everyone, means all users has access. 
        * Get the Everyone Group ID from the Groups table and assign all users to this group id
      - Admin Group - is a sisense default group which contain the list of all Admin users.
        Admin Users are users which have the following Roles: Sys. Admin, Admin, Data Admin, Tenant Admin (for multi tenant cases).
      * Get the Admins Group ID from the Groups table and assign all users with Admin roles
    4. Create Dashboard (Fact) table - Note that the dashboards API can provide multiple records for the same Dashboard OID.
      Table Logic breaks into the following sub tables: 
      - First table - Share type = 'User'
      - Second table - filter on Share type = 'Group' and join the dashboard information with the Users_groups table. this join will translate the information of the Dashboard shared with Groups into the users belongs to that Groups. 
      - Use Union to remove duplication records.

    Best Regards