external-user-group.ts 1.8 KB

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