Skip to content

insights: return the right set of dashboards based on user and orgs

Administrator requested to merge insights/api/dashboard-permissions into main

Created by: CristinaBirkel

Closes #25708 (closed)

Description

Prior to this change, only global dashboards were returned from GetDashboards because the user/org context was not passed in. With this PR, it will get all visible dashboards based on the userId and the orgs the user belongs to.

I used the same logic from the existing compute method in the insightConnectionResolver, but I pulled it out into its own helper method so that we can easily use the same logic wherever we might need it. I mainly didn't want to duplicate the comment, and generally thought it would be useful. Let me know what you think!

Testing Steps

I tested this with the insightsDashboards API query, and by manually changing around the grants in the database to make sure I was seeing what I expected each time.

query {
	insightsDashboards() {
    	nodes { id, title, views { nodes { id }}}
    }
}

Merge request reports

Loading