2
0
kaori 5 жил өмнө
parent
commit
67a2ec5b9f

+ 13 - 3
src/server/service/page.js

@@ -54,10 +54,20 @@ class PageService {
     await pages.map(page => page.populate({ path: 'revision', model: 'Revision', select: 'body' }).execPopulate());
     await pages.map(page => page.populate({ path: 'revision', model: 'Revision', select: 'body' }).execPopulate());
 
 
     // create option
     // create option
+    // options.grant = page.grant;
+    // options.grantUserGroupId = page.grantedGroup;
+    // options.grantedUsers = page.grantedUsers;
+
+
+    // 複数にするべきか(grantUserGroupIds → ids or 一つづつ格納すべきか)
     const options = { pages };
     const options = { pages };
-    options.grant = pages.grant;
-    options.grantUserGroupId = pages.grantedGroup;
-    options.grantedUsers = pages.grantedUsers;
+    options.grant = pages.map(page => page.grant);
+    options.grantUserGroupId = pages.map(page => page.grantedGroup);
+    options.grantedUsers = pages.map(page => page.grantedUsers);
+
+    console.log(`grant = ${options.grant}`);
+    console.log(`grantUserGroupId = ${options.grantUserGroupId}`);
+    console.log(`grantedUsers = ${options.grantedUsers}`);
 
 
     const createdPage = await Page.create(
     const createdPage = await Page.create(
       newPagePath, pages.revision.body, user, options,
       newPagePath, pages.revision.body, user, options,