mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 10:20:29 -06:00
AccessControl: add permission to datasource permissions navigation selection (#38758)
This commit is contained in:
parent
d5956ce4b7
commit
cf7034ee50
@ -1,5 +1,7 @@
|
||||
import { DataSourceSettings, PluginType, PluginInclude, NavModel, NavModelItem } from '@grafana/data';
|
||||
import config from 'app/core/config';
|
||||
import { contextSrv } from 'app/core/core';
|
||||
import { AccessControlAction } from 'app/types';
|
||||
import { GenericDataSourcePlugin } from '../settings/PluginSettings';
|
||||
|
||||
export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDataSourcePlugin): NavModelItem {
|
||||
@ -46,13 +48,15 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
|
||||
}
|
||||
|
||||
if (config.licenseInfo.hasLicense) {
|
||||
navModel.children!.push({
|
||||
active: false,
|
||||
icon: 'lock',
|
||||
id: `datasource-permissions-${dataSource.id}`,
|
||||
text: 'Permissions',
|
||||
url: `datasources/edit/${dataSource.id}/permissions`,
|
||||
});
|
||||
if (contextSrv.hasPermission(AccessControlAction.DataSourcesPermissionsRead)) {
|
||||
navModel.children!.push({
|
||||
active: false,
|
||||
icon: 'lock',
|
||||
id: `datasource-permissions-${dataSource.id}`,
|
||||
text: 'Permissions',
|
||||
url: `datasources/edit/${dataSource.id}/permissions`,
|
||||
});
|
||||
}
|
||||
|
||||
navModel.children!.push({
|
||||
active: false,
|
||||
|
@ -39,6 +39,7 @@ export enum AccessControlAction {
|
||||
DataSourcesCreate = 'datasources:create',
|
||||
DataSourcesWrite = 'datasources:write',
|
||||
DataSourcesDelete = 'datasources:delete',
|
||||
DataSourcesPermissionsRead = 'datasources.permissions:read',
|
||||
|
||||
ActionServerStatsRead = 'server.stats:read',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user