ldap.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import { User, UserSession } from 'app/types';
  2. interface LdapMapping {
  3. cfgAttrValue: string;
  4. ldapValue: string;
  5. }
  6. export interface LdapError {
  7. title: string;
  8. body: string;
  9. }
  10. export interface SyncInfo {
  11. enabled: boolean;
  12. schedule: string;
  13. nextSync: string;
  14. prevSync?: SyncResult;
  15. }
  16. export interface LdapUserSyncInfo {
  17. nextSync?: string;
  18. prevSync?: string;
  19. status?: string;
  20. }
  21. export interface SyncResult {
  22. started: string;
  23. elapsed: string;
  24. UpdatedUserIds: number[];
  25. MissingUserIds: number[];
  26. FailedUsers?: FailedUser[];
  27. }
  28. export interface FailedUser {
  29. Login: string;
  30. Error: string;
  31. }
  32. export interface LdapRole {
  33. orgId: number;
  34. orgName: string;
  35. orgRole: string;
  36. groupDN: string;
  37. }
  38. export interface LdapTeam {
  39. orgName: string;
  40. teamName: string;
  41. groupDN: string;
  42. }
  43. export interface LdapUserInfo {
  44. name: LdapMapping;
  45. surname: LdapMapping;
  46. email: LdapMapping;
  47. login: LdapMapping;
  48. }
  49. export interface LdapPermissions {
  50. isGrafanaAdmin: boolean;
  51. isDisabled: boolean;
  52. }
  53. export interface LdapUser {
  54. info: LdapUserInfo;
  55. permissions: LdapPermissions;
  56. roles: LdapRole[];
  57. teams: LdapTeam[];
  58. }
  59. export interface LdapServerInfo {
  60. available: boolean;
  61. host: string;
  62. port: number;
  63. error: string;
  64. }
  65. export type LdapConnectionInfo = LdapServerInfo[];
  66. export interface LdapState {
  67. connectionInfo: LdapConnectionInfo;
  68. user?: LdapUser;
  69. syncInfo?: SyncInfo;
  70. connectionError?: LdapError;
  71. userError?: LdapError;
  72. ldapError?: LdapError;
  73. }
  74. export interface LdapUserState {
  75. user?: User;
  76. ldapUser?: LdapUser;
  77. ldapSyncInfo?: SyncInfo;
  78. sessions?: UserSession[];
  79. userError?: LdapError;
  80. }