Taichi Masuyama 3 лет назад
Родитель
Сommit
fdfaa35e06
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      packages/app/src/server/service/page-grant.ts

+ 5 - 2
packages/app/src/server/service/page-grant.ts

@@ -430,7 +430,6 @@ class PageGrantService {
       return data;
       return data;
     }
     }
 
 
-    // -- Public is not applicable below
     const parent = await Page.findById(page.parent);
     const parent = await Page.findById(page.parent);
     if (parent == null) {
     if (parent == null) {
       throw Error('The page\'s parent does not exist.');
       throw Error('The page\'s parent does not exist.');
@@ -462,7 +461,11 @@ class PageGrantService {
 
 
       const applicableGroups = await UserGroupRelation.findGroupsWithDescendantsByGroupAndUser(group, user);
       const applicableGroups = await UserGroupRelation.findGroupsWithDescendantsByGroupAndUser(group, user);
 
 
-      data[Page.GRANT_OWNER] = null;
+      const isUserExistInGroup = await UserGroupRelation.countByGroupIdAndUser(group, user) > 0;
+
+      if (isUserExistInGroup) {
+        data[Page.GRANT_OWNER] = null;
+      }
       data[Page.GRANT_USER_GROUP] = { applicableGroups };
       data[Page.GRANT_USER_GROUP] = { applicableGroups };
     }
     }