Commit f22b768c by Torkel Ödegaard Committed by GitHub

Dashboard: Do not allow users without edit permission to a folder to see new…

Dashboard: Do not allow users without edit permission to a folder to see new dashboard page (#28249)
parent fa45731b
import './dashboard_loaders'; import './dashboard_loaders';
import './ReactContainer'; import './ReactContainer';
import { applyRouteRegistrationHandlers } from './registry'; import { applyRouteRegistrationHandlers } from './registry';
import { contextSrv } from 'app/core/services/context_srv';
// Pages // Pages
import LdapPage from 'app/features/admin/ldap/LdapPage'; import LdapPage from 'app/features/admin/ldap/LdapPage';
import UserAdminPage from 'app/features/admin/UserAdminPage'; import UserAdminPage from 'app/features/admin/UserAdminPage';
...@@ -70,6 +72,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati ...@@ -70,6 +72,7 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati
routeInfo: DashboardRouteInfo.New, routeInfo: DashboardRouteInfo.New,
reloadOnSearch: false, reloadOnSearch: false,
resolve: { resolve: {
roles: () => (contextSrv.hasEditPermissionInFolders ? [contextSrv.user.orgRole] : ['Admin']),
component: importDashboardPage, component: importDashboardPage,
}, },
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment