page-grant.test.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. import mongoose from 'mongoose';
  2. import { PageGrant } from '~/interfaces/page';
  3. import UserGroup from '~/server/models/user-group';
  4. import { getInstance } from '../setup-crowi';
  5. /*
  6. * There are 3 grant types to test.
  7. * GRANT_PUBLIC, GRANT_OWNER, GRANT_USER_GROUP
  8. */
  9. describe('PageGrantService', () => {
  10. /*
  11. * models
  12. */
  13. let User;
  14. let Page;
  15. let UserGroupRelation;
  16. /*
  17. * global instances
  18. */
  19. let crowi;
  20. let pageGrantService;
  21. let xssSpy;
  22. let user1;
  23. let user2;
  24. let groupParent;
  25. let groupChild;
  26. let rootPage;
  27. let rootPublicPage;
  28. let rootOnlyMePage;
  29. let emptyPage1;
  30. let emptyPage2;
  31. let emptyPage3;
  32. const emptyPagePath1 = '/E1';
  33. const emptyPagePath2 = '/E2';
  34. const emptyPagePath3 = '/E3';
  35. let pageRootPublic;
  36. let pageRootGroupParent;
  37. const pageRootPublicPath = '/Public';
  38. const pageRootGroupParentPath = '/GroupParent';
  39. const pageRootOnlyMePagePath = '/OnlyMe';
  40. // const v4PageRootPublicPath = '/v4Public';
  41. const v4PageRootOnlyMePagePath = '/v4OnlyMe';
  42. const v4PageRootAnyoneWithTheLinkPagePath = '/v4AnyoneWithTheLink';
  43. const v4PageRootOnlyInsideTheGroupPagePath = '/v4OnlyInsideTheGroup';
  44. const pagePublicOnlyMePath = `${pageRootPublicPath}/OnlyMe`;
  45. const pagePublicAnyoneWithTheLinkPath = `${pageRootPublicPath}/AnyoneWithTheLink`;
  46. const pagePublicOnlyInsideTheGroupPath = `${pageRootPublicPath}/OnlyInsideTheGroup`;
  47. const pageOnlyMePublicPath = `${v4PageRootOnlyMePagePath}/Public`;
  48. const pageOnlyMeAnyoneWithTheLinkPath = `${v4PageRootOnlyMePagePath}/AnyoneWithTheLink`;
  49. const pageOnlyMeOnlyInsideTheGroupPath = `${v4PageRootOnlyMePagePath}/OnlyInsideTheGroup`;
  50. let pageE1Public;
  51. let pageE2User1;
  52. let pageE3GroupParent;
  53. let pageE3GroupChild;
  54. let pageE3User1;
  55. const pageE1PublicPath = '/E1/Public';
  56. const pageE2User1Path = '/E2/User1';
  57. const pageE3GroupParentPath = '/E3/GroupParent';
  58. const pageE3GroupChildPath = '/E3/GroupChild';
  59. const pageE3User1Path = '/E3/User1';
  60. /*
  61. * prepare before all tests
  62. */
  63. beforeAll(async() => {
  64. crowi = await getInstance();
  65. pageGrantService = crowi.pageGrantService;
  66. User = mongoose.model('User');
  67. Page = mongoose.model('Page');
  68. UserGroupRelation = mongoose.model('UserGroupRelation');
  69. // Users
  70. await User.insertMany([
  71. { name: 'User1', username: 'User1', email: 'user1@example.com' },
  72. { name: 'User2', username: 'User2', email: 'user2@example.com' },
  73. ]);
  74. user1 = await User.findOne({ username: 'User1' });
  75. user2 = await User.findOne({ username: 'User2' });
  76. // Parent user groups
  77. await UserGroup.insertMany([
  78. {
  79. name: 'GroupParent',
  80. parent: null,
  81. },
  82. ]);
  83. groupParent = await UserGroup.findOne({ name: 'GroupParent' });
  84. // Child user groups
  85. await UserGroup.insertMany([
  86. {
  87. name: 'GroupChild',
  88. parent: groupParent._id,
  89. },
  90. ]);
  91. groupChild = await UserGroup.findOne({ name: 'GroupChild' });
  92. // UserGroupRelations
  93. await UserGroupRelation.insertMany([
  94. {
  95. relatedGroup: groupParent._id,
  96. relatedUser: user1._id,
  97. },
  98. {
  99. relatedGroup: groupParent._id,
  100. relatedUser: user2._id,
  101. },
  102. {
  103. relatedGroup: groupChild._id,
  104. relatedUser: user1._id,
  105. },
  106. ]);
  107. // Root page (Depth: 0)
  108. rootPage = await Page.findOne({ path: '/' });
  109. // Empty pages (Depth: 1)
  110. await Page.insertMany([
  111. {
  112. path: emptyPagePath1,
  113. grant: Page.GRANT_PUBLIC,
  114. isEmpty: true,
  115. parent: rootPage._id,
  116. },
  117. {
  118. path: emptyPagePath2,
  119. grant: Page.GRANT_PUBLIC,
  120. isEmpty: true,
  121. parent: rootPage._id,
  122. },
  123. {
  124. path: emptyPagePath3,
  125. grant: Page.GRANT_PUBLIC,
  126. isEmpty: true,
  127. parent: rootPage._id,
  128. },
  129. {
  130. path: pageRootPublicPath,
  131. grant: Page.GRANT_PUBLIC,
  132. creator: user1,
  133. lastUpdateUser: user1,
  134. grantedUsers: null,
  135. grantedGroup: null,
  136. parent: rootPage._id,
  137. },
  138. {
  139. path: pageRootGroupParentPath,
  140. grant: Page.GRANT_USER_GROUP,
  141. creator: user1,
  142. lastUpdateUser: user1,
  143. grantedUsers: null,
  144. grantedGroup: groupParent._id,
  145. parent: rootPage._id,
  146. },
  147. ]);
  148. await Page.insertMany([
  149. // Root Page
  150. {
  151. path: rootPage,
  152. grant: Page.GRANT_PUBLIC,
  153. parent: null,
  154. },
  155. // OnlyMe v4
  156. {
  157. path: v4PageRootOnlyMePagePath,
  158. grant: Page.GRANT_OWNER,
  159. grantedUsers: [user1._id],
  160. parent: null,
  161. },
  162. // AnyoneWithTheLink v4
  163. {
  164. path: v4PageRootAnyoneWithTheLinkPagePath,
  165. grant: Page.GRANT_RESTRICTED,
  166. parent: null,
  167. },
  168. // OnlyInsideTheGroup v4
  169. {
  170. path: v4PageRootOnlyInsideTheGroupPagePath,
  171. grant: Page.GRANT_USER_GROUP,
  172. parent: null,
  173. },
  174. ]);
  175. rootPublicPage = await Page.findOne({ path: pageRootPublicPath });
  176. rootOnlyMePage = await Page.findOne({ path: v4PageRootOnlyMePagePath });
  177. // Leaf pages (Depth: 2)
  178. await Page.insertMany([
  179. /*
  180. * Parent is public
  181. */
  182. {
  183. path: pagePublicOnlyMePath,
  184. grant: Page.GRANT_OWNER,
  185. parent: rootPublicPage._id,
  186. },
  187. {
  188. path: pagePublicAnyoneWithTheLinkPath,
  189. grant: Page.GRANT_RESTRICTED,
  190. parent: rootPublicPage._id,
  191. },
  192. {
  193. path: pagePublicOnlyInsideTheGroupPath,
  194. grant: Page.GRANT_USER_GROUP,
  195. parent: rootPublicPage._id,
  196. },
  197. /*
  198. * Parent is onlyMe
  199. */
  200. {
  201. path: pageOnlyMePublicPath,
  202. grant: Page.GRANT_PUBLIC,
  203. parent: rootOnlyMePage._id,
  204. },
  205. {
  206. path: pageOnlyMeAnyoneWithTheLinkPath,
  207. grant: Page.GRANT_RESTRICTED,
  208. parent: rootOnlyMePage._id,
  209. },
  210. {
  211. path: pageOnlyMeOnlyInsideTheGroupPath,
  212. grant: Page.GRANT_USER_GROUP,
  213. parent: rootOnlyMePage._id,
  214. },
  215. ]);
  216. emptyPage1 = await Page.findOne({ path: emptyPagePath1 });
  217. emptyPage2 = await Page.findOne({ path: emptyPagePath2 });
  218. emptyPage3 = await Page.findOne({ path: emptyPagePath3 });
  219. // Leaf pages (Depth: 2)
  220. await Page.insertMany([
  221. {
  222. path: pageE1PublicPath,
  223. grant: Page.GRANT_PUBLIC,
  224. creator: user1,
  225. lastUpdateUser: user1,
  226. grantedUsers: null,
  227. grantedGroup: null,
  228. parent: emptyPage1._id,
  229. },
  230. {
  231. path: pageE2User1Path,
  232. grant: Page.GRANT_OWNER,
  233. creator: user1,
  234. lastUpdateUser: user1,
  235. grantedUsers: [user1._id],
  236. grantedGroup: null,
  237. parent: emptyPage2._id,
  238. },
  239. {
  240. path: pageE3GroupParentPath,
  241. grant: Page.GRANT_USER_GROUP,
  242. creator: user1,
  243. lastUpdateUser: user1,
  244. grantedUsers: null,
  245. grantedGroup: groupParent._id,
  246. parent: emptyPage3._id,
  247. },
  248. {
  249. path: pageE3GroupChildPath,
  250. grant: Page.GRANT_USER_GROUP,
  251. creator: user1,
  252. lastUpdateUser: user1,
  253. grantedUsers: null,
  254. grantedGroup: groupChild._id,
  255. parent: emptyPage3._id,
  256. },
  257. {
  258. path: pageE3User1Path,
  259. grant: Page.GRANT_OWNER,
  260. creator: user1,
  261. lastUpdateUser: user1,
  262. grantedUsers: [user1._id],
  263. grantedGroup: null,
  264. parent: emptyPage3._id,
  265. },
  266. ]);
  267. pageE1Public = await Page.findOne({ path: pageE1PublicPath });
  268. pageE2User1 = await Page.findOne({ path: pageE2User1Path });
  269. pageE3GroupParent = await Page.findOne({ path: pageE3GroupParentPath });
  270. pageE3GroupChild = await Page.findOne({ path: pageE3GroupChildPath });
  271. pageE3User1 = await Page.findOne({ path: pageE3User1Path });
  272. xssSpy = jest.spyOn(crowi.xss, 'process').mockImplementation(path => path);
  273. });
  274. describe('Test isGrantNormalized method with shouldCheckDescendants false', () => {
  275. test('Should return true when Ancestor: root, Target: public', async() => {
  276. const targetPath = '/NEW';
  277. const grant = Page.GRANT_PUBLIC;
  278. const grantedUserIds = null;
  279. const grantedGroupId = null;
  280. const shouldCheckDescendants = false;
  281. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  282. expect(result).toBe(true);
  283. });
  284. test('Should return true when Ancestor: root, Target: GroupParent', async() => {
  285. const targetPath = '/NEW_GroupParent';
  286. const grant = Page.GRANT_USER_GROUP;
  287. const grantedUserIds = null;
  288. const grantedGroupId = groupParent._id;
  289. const shouldCheckDescendants = false;
  290. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  291. expect(result).toBe(true);
  292. });
  293. test('Should return true when Ancestor: under-root public, Target: public', async() => {
  294. const targetPath = `${pageRootPublicPath}/NEW`;
  295. const grant = Page.GRANT_PUBLIC;
  296. const grantedUserIds = null;
  297. const grantedGroupId = null;
  298. const shouldCheckDescendants = false;
  299. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  300. expect(result).toBe(true);
  301. });
  302. test('Should return true when Ancestor: under-root GroupParent, Target: GroupParent', async() => {
  303. const targetPath = `${pageRootGroupParentPath}/NEW`;
  304. const grant = Page.GRANT_USER_GROUP;
  305. const grantedUserIds = null;
  306. const grantedGroupId = groupParent._id;
  307. const shouldCheckDescendants = false;
  308. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  309. expect(result).toBe(true);
  310. });
  311. test('Should return true when Ancestor: public, Target: public', async() => {
  312. const targetPath = `${pageE1PublicPath}/NEW`;
  313. const grant = Page.GRANT_PUBLIC;
  314. const grantedUserIds = null;
  315. const grantedGroupId = null;
  316. const shouldCheckDescendants = false;
  317. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  318. expect(result).toBe(true);
  319. });
  320. test('Should return true when Ancestor: owned by User1, Target: owned by User1', async() => {
  321. const targetPath = `${pageE2User1Path}/NEW`;
  322. const grant = Page.GRANT_OWNER;
  323. const grantedUserIds = [user1._id];
  324. const grantedGroupId = null;
  325. const shouldCheckDescendants = false;
  326. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  327. expect(result).toBe(true);
  328. });
  329. test('Should return false when Ancestor: owned by GroupParent, Target: public', async() => {
  330. const targetPath = `${pageE3GroupParentPath}/NEW`;
  331. const grant = Page.GRANT_PUBLIC;
  332. const grantedUserIds = null;
  333. const grantedGroupId = null;
  334. const shouldCheckDescendants = false;
  335. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  336. expect(result).toBe(false);
  337. });
  338. test('Should return false when Ancestor: owned by GroupChild, Target: GroupParent', async() => {
  339. const targetPath = `${pageE3GroupChildPath}/NEW`;
  340. const grant = Page.GRANT_USER_GROUP;
  341. const grantedUserIds = null;
  342. const grantedGroupId = groupParent._id;
  343. const shouldCheckDescendants = false;
  344. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  345. expect(result).toBe(false);
  346. });
  347. });
  348. describe('Test isGrantNormalized method with shouldCheckDescendants true', () => {
  349. test('Should return true when Target: public, Descendant: public', async() => {
  350. const targetPath = emptyPagePath1;
  351. const grant = Page.GRANT_PUBLIC;
  352. const grantedUserIds = null;
  353. const grantedGroupId = null;
  354. const shouldCheckDescendants = true;
  355. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  356. expect(result).toBe(true);
  357. });
  358. test('Should return true when Target: owned by User1, Descendant: User1 only', async() => {
  359. const targetPath = emptyPagePath2;
  360. const grant = Page.GRANT_OWNER;
  361. const grantedUserIds = [user1._id];
  362. const grantedGroupId = null;
  363. const shouldCheckDescendants = true;
  364. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  365. expect(result).toBe(true);
  366. });
  367. test('Should return true when Target: owned by GroupParent, Descendant: GroupParent, GroupChild and User1', async() => {
  368. const targetPath = emptyPagePath3;
  369. const grant = Page.GRANT_USER_GROUP;
  370. const grantedUserIds = null;
  371. const grantedGroupId = groupParent._id;
  372. const shouldCheckDescendants = true;
  373. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  374. expect(result).toBe(true);
  375. });
  376. test('Should return false when Target: owned by UserA, Descendant: public', async() => {
  377. const targetPath = emptyPagePath1;
  378. const grant = Page.GRANT_OWNER;
  379. const grantedUserIds = [user1._id];
  380. const grantedGroupId = null;
  381. const shouldCheckDescendants = true;
  382. const result = await pageGrantService.isGrantNormalized(user1, targetPath, grant, grantedUserIds, grantedGroupId, shouldCheckDescendants);
  383. expect(result).toBe(false);
  384. });
  385. });
  386. describe('Test for calcApplicableGrantData', () => {
  387. test('Only Public is Applicable in case of top page', async() => {
  388. const result = await pageGrantService.calcApplicableGrantData(rootPage, user1);
  389. await expect(result[PageGrant.GRANT_PUBLIC]).toBeNull();
  390. });
  391. // parent property of all private pages is null
  392. test('Any grant is allowed if parent is null', async() => {
  393. const userGroupRelation = await UserGroupRelation.findAllUserGroupIdsRelatedToUser(user1);
  394. // OnlyMe
  395. const rootOnlyMePage = await Page.findOne({ path: v4PageRootOnlyMePagePath });
  396. const rootOnlyMePageRes = await pageGrantService.calcApplicableGrantData(rootOnlyMePage, user1);
  397. await expect(rootOnlyMePageRes[PageGrant.GRANT_PUBLIC]).toBeNull();
  398. await expect(rootOnlyMePageRes[PageGrant.GRANT_OWNER]).toBeNull();
  399. await expect(rootOnlyMePageRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
  400. // AnyoneWithTheLink
  401. const rootAnyoneWithTheLinkPage = await Page.findOne({ path: v4PageRootAnyoneWithTheLinkPagePath });
  402. const AnyoneWithTheLinkRes = await pageGrantService.calcApplicableGrantData(rootAnyoneWithTheLinkPage, user1);
  403. await expect(AnyoneWithTheLinkRes[PageGrant.GRANT_PUBLIC]).toBeNull();
  404. await expect(AnyoneWithTheLinkRes[PageGrant.GRANT_OWNER]).toBeNull();
  405. await expect(AnyoneWithTheLinkRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
  406. // OnlyInsideTheGroup
  407. const rootOnlyInsideTheGroupPage = await Page.findOne({ path: v4PageRootOnlyInsideTheGroupPagePath });
  408. const onlyInsideTheGroupRes = await pageGrantService.calcApplicableGrantData(rootOnlyInsideTheGroupPage, user1);
  409. await expect(onlyInsideTheGroupRes[PageGrant.GRANT_PUBLIC]).toBeNull();
  410. await expect(onlyInsideTheGroupRes[PageGrant.GRANT_OWNER]).toBeNull();
  411. await expect(onlyInsideTheGroupRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
  412. });
  413. test('Any grant is allowed if parent is public', async() => {
  414. const userGroupRelation = await UserGroupRelation.findAllUserGroupIdsRelatedToUser(user1);
  415. // OnlyMe
  416. const publicOnlyMePage = await Page.findOne({ path: pagePublicOnlyMePath });
  417. const publicOnlyMeRes = await pageGrantService.calcApplicableGrantData(publicOnlyMePage, user1);
  418. await expect(publicOnlyMeRes[PageGrant.GRANT_PUBLIC]).toBeNull();
  419. await expect(publicOnlyMeRes[PageGrant.GRANT_OWNER]).toBeNull();
  420. await expect(publicOnlyMeRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
  421. // AnyoneWithTheLink
  422. const publicAnyoneWithTheLinkPage = await Page.findOne({ path: pagePublicAnyoneWithTheLinkPath });
  423. const publicAnyoneWithTheLinkRes = await pageGrantService.calcApplicableGrantData(publicAnyoneWithTheLinkPage, user1);
  424. await expect(publicAnyoneWithTheLinkRes[PageGrant.GRANT_PUBLIC]).toBeNull();
  425. await expect(publicAnyoneWithTheLinkRes[PageGrant.GRANT_OWNER]).toBeNull();
  426. await expect(publicAnyoneWithTheLinkRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
  427. // OnlyInsideTheGroup
  428. const publicOnlyInsideTheGroupPage = await Page.findOne({ path: pagePublicOnlyInsideTheGroupPath });
  429. const publicOnlyInsideTheGroupRes = await pageGrantService.calcApplicableGrantData(publicOnlyInsideTheGroupPage, user1);
  430. await expect(publicOnlyInsideTheGroupRes[PageGrant.GRANT_PUBLIC]).toBeNull();
  431. await expect(publicOnlyInsideTheGroupRes[PageGrant.GRANT_OWNER]).toBeNull();
  432. await expect(publicOnlyInsideTheGroupRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
  433. });
  434. test('Only "GRANT_OWNER" is allowed if the user is the parent page\'s grantUser', async() => {
  435. // Public
  436. const onlyMePublicPage = await Page.findOne({ path: pageOnlyMePublicPath });
  437. const onlyMePublicRes = await pageGrantService.calcApplicableGrantData(onlyMePublicPage, user1);
  438. await expect(onlyMePublicRes[PageGrant.GRANT_OWNER]).toBeNull();
  439. // AnyoneWithTheLink
  440. const onlyMeAnyoneWithTheLinkPage = await Page.findOne({ path: pageOnlyMeAnyoneWithTheLinkPath });
  441. const onlyMeAnyoneWithTheLinkRes = await pageGrantService.calcApplicableGrantData(onlyMeAnyoneWithTheLinkPage, user1);
  442. await expect(onlyMeAnyoneWithTheLinkRes[PageGrant.GRANT_OWNER]).toBeNull();
  443. // OnlyInsideTheGroup
  444. const publicOnlyInsideTheGroupPage = await Page.findOne({ path: pageOnlyMeOnlyInsideTheGroupPath });
  445. const publicOnlyInsideTheGroupRes = await pageGrantService.calcApplicableGrantData(publicOnlyInsideTheGroupPage, user1);
  446. await expect(publicOnlyInsideTheGroupRes[PageGrant.GRANT_OWNER]).toBeNull();
  447. });
  448. // test('UserGroup included the user Only "GRANT_OWNER" is allowed if the parent page\'s grant is GRANT_USER_GROUP', async() => {
  449. // // Public
  450. // const onlyMePublicPage = await Page.findOne({ path: pageOnlyMePublicPath });
  451. // const onlyMePublicRes = await pageGrantService.calcApplicableGrantData(onlyMePublicPage, user1);
  452. // await expect(onlyMePublicRes[PageGrant.GRANT_OWNER]).toBeNull();
  453. // // OnlyMe
  454. // const onlyMeAnyoneWithTheLinkPage = await Page.findOne({ path: pageOnlyMeAnyoneWithTheLinkPath });
  455. // const onlyMeAnyoneWithTheLinkRes = await pageGrantService.calcApplicableGrantData(onlyMeAnyoneWithTheLinkPage, user1);
  456. // await expect(onlyMeAnyoneWithTheLinkRes[PageGrant.GRANT_OWNER]).toBeNull();
  457. // // AnyoneWithTheLink
  458. // const publicOnlyInsideTheGroupPage = await Page.findOne({ path: pageOnlyMeOnlyInsideTheGroupPath });
  459. // const publicOnlyInsideTheGroupRes = await pageGrantService.calcApplicableGrantData(publicOnlyInsideTheGroupPage, user1);
  460. // await expect(publicOnlyInsideTheGroupRes[PageGrant.GRANT_OWNER]).toBeNull();
  461. // });
  462. });
  463. });