Prechádzať zdrojové kódy

Change to backend solution

arvid-e 3 mesiacov pred
rodič
commit
3fb5d84a5e

+ 10 - 1
apps/app/src/server/routes/apiv3/page-listing.ts

@@ -155,15 +155,24 @@ const routerFactory = (crowi: Crowi): Router => {
       const hideRestrictedByGroup = await configManager.getConfig(
         'security:list-policy:hideRestrictedByGroup',
       );
+      const hideUserPages = await configManager.getConfig(
+        'security:isHidingUserPages',
+      );
 
       try {
-        const pages =
+        let pages =
           await pageListingService.findChildrenByParentPathOrIdAndViewer(
             (id || path) as string,
             req.user,
             !hideRestrictedByOwner,
             !hideRestrictedByGroup,
           );
+
+        if (hideUserPages === true) {
+          const isUserPagePath = /^\/user(\/|$)/;
+          pages = pages.filter((page) => !isUserPagePath.test(page.path));
+        }
+
         return res.apiv3({ children: pages });
       } catch (err) {
         logger.error('Error occurred while finding children.', err);