external-user-group.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import type {
  2. HasObjectId, IUserGroupRelation, Ref, IUserGroup,
  3. } from '@growi/core';
  4. export const ExternalGroupProviderType = { ldap: 'ldap' } as const;
  5. export type ExternalGroupProviderType = typeof ExternalGroupProviderType[keyof typeof ExternalGroupProviderType];
  6. export interface IExternalUserGroup extends Omit<IUserGroup, 'parent'> {
  7. parent: Ref<IExternalUserGroup> | null
  8. externalId: string // identifier used in external app/server
  9. provider: ExternalGroupProviderType
  10. }
  11. export type IExternalUserGroupHasId = IExternalUserGroup & HasObjectId;
  12. export interface IExternalUserGroupRelation extends Omit<IUserGroupRelation, 'relatedGroup'> {
  13. relatedGroup: Ref<IExternalUserGroup>
  14. }
  15. export type IExternalUserGroupRelationHasId = IExternalUserGroupRelation & HasObjectId;
  16. export const LdapGroupMembershipAttributeType = { dn: 'DN', uid: 'UID' } as const;
  17. type LdapGroupMembershipAttributeType = typeof LdapGroupMembershipAttributeType[keyof typeof LdapGroupMembershipAttributeType];
  18. export interface LdapGroupSyncSettings {
  19. ldapGroupSearchBase: string
  20. ldapGroupMembershipAttribute: string
  21. ldapGroupMembershipAttributeType: LdapGroupMembershipAttributeType
  22. ldapGroupChildGroupAttribute: string
  23. autoGenerateUserOnLdapGroupSync: boolean
  24. preserveDeletedLdapGroups: boolean
  25. ldapGroupNameAttribute: string
  26. ldapGroupDescriptionAttribute?: string
  27. }
  28. export type ExternalUserInfo = {
  29. id: string, // external user id
  30. username: string,
  31. name?: string,
  32. email?: string,
  33. }
  34. // Data structure to express the tree structure of external groups, before converting to ExternalUserGroup model
  35. export interface ExternalUserGroupTreeNode {
  36. id: string // external group id
  37. userInfos: ExternalUserInfo[]
  38. childGroupNodes: ExternalUserGroupTreeNode[]
  39. name: string
  40. description?: string
  41. }