page-grant.ts 1.1 KB

1234567891011121314151617181920212223242526272829
  1. import { PageGrant, GroupType } from '@growi/core';
  2. import { ExternalUserGroupDocument } from '~/features/external-user-group/server/models/external-user-group';
  3. import { UserGroupDocument } from '~/server/models/user-group';
  4. import { IPageGrantData } from './page';
  5. type UserGroupType = typeof GroupType.userGroup;
  6. type ExternalUserGroupType = typeof GroupType.externalUserGroup;
  7. export type ApplicableGroup = {type: UserGroupType, item: UserGroupDocument } | {type: ExternalUserGroupType, item: ExternalUserGroupDocument }
  8. export type IDataApplicableGroup = {
  9. applicableGroups?: ApplicableGroup[]
  10. }
  11. export type IDataApplicableGrant = null | IDataApplicableGroup;
  12. export type IRecordApplicableGrant = Partial<Record<PageGrant, IDataApplicableGrant>>
  13. export type IResApplicableGrant = {
  14. data?: IRecordApplicableGrant
  15. }
  16. export type IResIsGrantNormalizedGrantData = {
  17. isForbidden: boolean,
  18. currentPageGrant: IPageGrantData,
  19. parentPageGrant?: IPageGrantData
  20. }
  21. export type IResIsGrantNormalized = {
  22. isGrantNormalized: boolean,
  23. grantData: IResIsGrantNormalizedGrantData
  24. };