Yuki Takei 1 год назад
Родитель
Сommit
b26867f6df
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      apps/app/src/server/routes/apiv3/page/index.ts

+ 4 - 2
apps/app/src/server/routes/apiv3/page/index.ts

@@ -3,6 +3,7 @@ import path from 'path';
 import type { IPage } from '@growi/core';
 import type { IPage } from '@growi/core';
 import {
 import {
   AllSubscriptionStatusType, PageGrant, SubscriptionStatusType,
   AllSubscriptionStatusType, PageGrant, SubscriptionStatusType,
+  getIdForRef,
 } from '@growi/core';
 } from '@growi/core';
 import { ErrorV3 } from '@growi/core/dist/models';
 import { ErrorV3 } from '@growi/core/dist/models';
 import { convertToNewAffiliationPath } from '@growi/core/dist/utils/page-path-utils';
 import { convertToNewAffiliationPath } from '@growi/core/dist/utils/page-path-utils';
@@ -592,7 +593,8 @@ module.exports = (crowi) => {
     } = page;
     } = page;
     let isGrantNormalized = false;
     let isGrantNormalized = false;
     try {
     try {
-      isGrantNormalized = await pageGrantService.isGrantNormalized(req.user, path, grant, grantedUsers, grantedGroups, false, false);
+      const grantedUsersId = grantedUsers.map(ref => getIdForRef(ref));
+      isGrantNormalized = await pageGrantService.isGrantNormalized(req.user, path, grant, grantedUsersId, grantedGroups, false, false);
     }
     }
     catch (err) {
     catch (err) {
       logger.error('Error occurred while processing isGrantNormalized.', err);
       logger.error('Error occurred while processing isGrantNormalized.', err);
@@ -615,7 +617,7 @@ module.exports = (crowi) => {
       return res.apiv3({ isGrantNormalized, grantData });
       return res.apiv3({ isGrantNormalized, grantData });
     }
     }
 
 
-    const parentPage = await Page.findByIdAndViewer(page.parent, req.user, null, false);
+    const parentPage = await Page.findByIdAndViewer(getIdForRef(page.parent), req.user, null, false);
 
 
     // user isn't allowed to see parent's grant
     // user isn't allowed to see parent's grant
     if (parentPage == null) {
     if (parentPage == null) {