AccessControl: "Add data source" button needs create and write rights to be enabled (#38934)

This commit is contained in:
Gabriel MABILLE 2021-09-08 09:47:55 +02:00 committed by GitHub
parent 10ffc9a754
commit e9631fdf7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -71,7 +71,10 @@ export class DataSourcesListPage extends PureComponent<Props> {
hasFetched,
} = this.props;
const canCreateDataSource = contextSrv.hasPermission(AccessControlAction.DataSourcesCreate);
const canCreateDataSource =
contextSrv.hasPermission(AccessControlAction.DataSourcesCreate) &&
contextSrv.hasPermission(AccessControlAction.DataSourcesWrite);
const linkButton = {
href: 'datasources/new',
title: 'Add data source',

View File

@ -8,7 +8,9 @@ import { AccessControlAction } from 'app/types';
export const NoDataSourceCallToAction = () => {
const theme = useTheme2();
const canCreateDataSource = contextSrv.hasPermission(AccessControlAction.DataSourcesCreate);
const canCreateDataSource =
contextSrv.hasPermission(AccessControlAction.DataSourcesCreate) &&
contextSrv.hasPermission(AccessControlAction.DataSourcesWrite);
const message =
'Explore requires at least one data source. Once you have added a data source, you can query it here.';