mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* LDAP Debug: No longer shows incorrectly matching groups based on role Org Role was used as a shortcut to figure out what groups were matching and which weren't. That lead to too all groups matching a specific role to show up for a user if that user got that role. * LDAP Debug: Fixes ordering of matches The order of groups in the ldap.toml file is important, only the first match for an organisation will be used. This means we have to iterate based on the config and stop matching when a match is found. We might want to think about showing further matches as potential matches that are shadowed by the first match. That would possibly make it easier to understand why one match is used instead of another one. * LDAP Debug: never display more than one match for the same LDAP group/mapping. * LDAP Debug: show all matches, even if they aren't used * Update public/app/features/admin/ldap/LdapUserGroups.tsx Co-Authored-By: gotjosh <josue.abreu@gmail.com> * Update public/app/features/admin/ldap/LdapUserGroups.tsx Co-Authored-By: gotjosh <josue.abreu@gmail.com>
70 lines
2.2 KiB
TypeScript
70 lines
2.2 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>
|
|
Organization
|
|
<Tooltip placement="top" content="Only the first match for an Organization will be used" theme={'info'}>
|
|
<span className="gf-form-help-icon">
|
|
<i className="fa fa-info-circle" />
|
|
</span>
|
|
</Tooltip>
|
|
</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>
|
|
);
|
|
};
|