1import React, { FC } from 'react';
2import { LdapUserMappingInfo } from './LdapUserMappingInfo';
3import { LdapUserPermissions } from './LdapUserPermissions';
4import { LdapUserGroups } from './LdapUserGroups';
5import { LdapUserTeams } from './LdapUserTeams';
6import { LdapUser } from 'app/types';
7
8interface Props {
9  ldapUser: LdapUser;
10  showAttributeMapping?: boolean;
11}
12
13export const LdapUserInfo: FC<Props> = ({ ldapUser, showAttributeMapping }) => {
14  return (
15    <>
16      <LdapUserMappingInfo info={ldapUser.info} showAttributeMapping={showAttributeMapping} />
17      <LdapUserPermissions permissions={ldapUser.permissions} />
18      {ldapUser.roles && ldapUser.roles.length > 0 && (
19        <LdapUserGroups groups={ldapUser.roles} showAttributeMapping={showAttributeMapping} />
20      )}
21
22      {ldapUser.teams && ldapUser.teams.length > 0 ? (
23        <LdapUserTeams teams={ldapUser.teams} showAttributeMapping={showAttributeMapping} />
24      ) : (
25        <div className="gf-form-group">
26          <div className="gf-form">
27            <table className="filter-table form-inline">
28              <tbody>
29                <tr>
30                  <td>No teams found via LDAP</td>
31                </tr>
32              </tbody>
33            </table>
34          </div>
35        </div>
36      )}
37    </>
38  );
39};
40