From 03978bd67297f5b8b3d63c9805bfab6c8d1e3ffd Mon Sep 17 00:00:00 2001 From: Rijk van Zanten Date: Fri, 15 Oct 2021 18:28:51 -0400 Subject: [PATCH] Fix dashboards for non-admin users (#8847) Fixes #8846 --- app/src/stores/insights.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/stores/insights.ts b/app/src/stores/insights.ts index 79852af900..988826df60 100644 --- a/app/src/stores/insights.ts +++ b/app/src/stores/insights.ts @@ -1,8 +1,7 @@ import { Dashboard } from '../types'; import api from '@/api'; import { defineStore } from 'pinia'; -import { useUserStore } from '@/stores'; -import { isAllowed } from '../utils/is-allowed'; +import { useUserStore, usePermissionsStore } from '@/stores'; export const useInsightsStore = defineStore({ id: 'insightsStore', @@ -12,12 +11,13 @@ export const useInsightsStore = defineStore({ actions: { async hydrate() { const userStore = useUserStore(); + const permissionsStore = usePermissionsStore(); - if (userStore.isAdmin !== true && !isAllowed('directus_dashboards', 'read', null)) { + if (userStore.isAdmin !== true && !permissionsStore.hasPermission('directus_dashboards', 'read')) { this.dashboards = []; } else { try { - const response = await api.get('/dashboards', { + const response = await api.get('/dashboards', { params: { limit: -1, fields: ['*', 'panels.*'], sort: ['name'] }, });