mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 09:05:45 -06:00
* LDAP: Show all LDAP groups * Use the returned LDAP groups as the reference when debugging LDAP We need to use the LDAP groups returned as the main reference for assuming what we were able to match and what wasn't. Before, we were using the configured groups in LDAP TOML configuration file. * s/User name/Username * Add a title to for the LDAP mapping results * LDAP: UI Updates to debug view * LDAP: Make it explicit when we weren't able to match teams
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import React, { FC } from 'react';
|
|
import { Tooltip } from '@grafana/ui';
|
|
import { LdapRole } from 'app/types';
|
|
|
|
interface Props {
|
|
groups: LdapRole[];
|
|
showAttributeMapping?: boolean;
|
|
}
|
|
|
|
export const LdapUserGroups: FC<Props> = ({ groups, showAttributeMapping }) => {
|
|
const items = showAttributeMapping ? groups : groups.filter(item => item.orgRole);
|
|
|
|
return (
|
|
<div className="gf-form-group">
|
|
<div className="gf-form">
|
|
<table className="filter-table form-inline">
|
|
<thead>
|
|
<tr>
|
|
{showAttributeMapping && <th>LDAP Group</th>}
|
|
<th>Organisation</th>
|
|
<th>Role</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{items.map((group, index) => {
|
|
return (
|
|
<tr key={`${group.orgId}-${index}`}>
|
|
{showAttributeMapping && (
|
|
<>
|
|
<td>{group.groupDN}</td>
|
|
{!group.orgRole && (
|
|
<>
|
|
<td />
|
|
<td>
|
|
<span className="text-warning">
|
|
No match
|
|
<Tooltip placement="top" content="No matching groups found" theme={'info'}>
|
|
<span className="gf-form-help-icon">
|
|
<i className="fa fa-info-circle" />
|
|
</span>
|
|
</Tooltip>
|
|
</span>
|
|
</td>
|
|
</>
|
|
)}
|
|
</>
|
|
)}
|
|
{group.orgName && (
|
|
<>
|
|
<td>{group.orgName}</td>
|
|
<td>{group.orgRole}</td>
|
|
</>
|
|
)}
|
|
</tr>
|
|
);
|
|
})}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|