page-grant.ts 1.1 KB

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