Auth: Move LDAP debug to Authentication menu (#71285)

* move LDAP page to Authentication

* tweak Auth menu showing permissions
This commit is contained in:
Jo
2023-07-12 18:15:02 +02:00
committed by GitHub
parent 3a45f02ef3
commit 9b22342b91
5 changed files with 23 additions and 21 deletions

View File

@@ -14,7 +14,7 @@ interface Props {
interface State {}
const format = 'dddd YYYY-MM-DD HH:mm zz';
const debugLDAPMappingBaseURL = '/admin/ldap';
const debugLDAPMappingBaseURL = '/admin/authentication/ldap';
export class UserLdapSyncInfo extends PureComponent<Props, State> {
onUserSync = () => {

View File

@@ -1,14 +1,13 @@
import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { NavModel } from '@grafana/data';
import { NavModelItem } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime';
import { Alert, Button, LegacyForms } from '@grafana/ui';
const { FormField } = LegacyForms;
import { Page } from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import {
AppNotificationSeverity,
LdapError,
@@ -32,7 +31,6 @@ import { LdapSyncInfo } from './LdapSyncInfo';
import { LdapUserInfo } from './LdapUserInfo';
interface OwnProps extends GrafanaRouteComponentProps<{}, { username?: string }> {
navModel: NavModel;
ldapConnectionInfo: LdapConnectionInfo;
ldapUser?: LdapUser;
ldapSyncInfo?: SyncInfo;
@@ -44,6 +42,13 @@ interface State {
isLoading: boolean;
}
const pageNav: NavModelItem = {
text: 'LDAP',
subTitle: `Verify your LDAP and user mapping configuration.`,
icon: 'book',
id: 'LDAP',
};
export class LdapPage extends PureComponent<Props, State> {
state = {
isLoading: true,
@@ -84,12 +89,12 @@ export class LdapPage extends PureComponent<Props, State> {
};
render() {
const { ldapUser, userError, ldapError, ldapSyncInfo, ldapConnectionInfo, navModel, queryParams } = this.props;
const { ldapUser, userError, ldapError, ldapSyncInfo, ldapConnectionInfo, queryParams } = this.props;
const { isLoading } = this.state;
const canReadLDAPUser = contextSrv.hasPermission(AccessControlAction.LDAPUsersRead);
return (
<Page navModel={navModel}>
<Page navId="authentication" pageNav={pageNav}>
<Page.Contents isLoading={isLoading}>
<>
{ldapError && ldapError.title && (
@@ -143,7 +148,6 @@ export class LdapPage extends PureComponent<Props, State> {
}
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'ldap'),
ldapConnectionInfo: state.ldap.connectionInfo,
ldapUser: state.ldap.user,
ldapSyncInfo: state.ldap.syncInfo,