Ver Fonte

Use list of excluded paths to not be usable using lsx

arvid-e há 3 meses atrás
pai
commit
960392969b

+ 14 - 0
apps/app/src/server/service/page/index.ts

@@ -796,6 +796,7 @@ class PageService implements IPageService {
     return renamedPage;
   }
 
+<<<<<<< HEAD
   async renameSubOperation(
     page,
     newPagePathSanitized: string,
@@ -805,6 +806,19 @@ class PageService implements IPageService {
     pageOpId: ObjectIdLike,
     activity?,
   ): Promise<void> {
+=======
+  getExcludedPathsBySystem(): string[] {
+    const excludedPaths: string[] = [];
+
+    if (configManager.getConfig('security:isHidingUserPages')) {
+      excludedPaths.push('/user');
+    }
+
+    return excludedPaths;
+  }
+
+  async renameSubOperation(page, newPagePath: string, user, options, renamedPage, pageOpId: ObjectIdLike, activity?): Promise<void> {
+>>>>>>> 01481adae4 (Use list of excluded paths to not be usable using lsx)
     const Page = mongoose.model('Page') as unknown as PageModel;
 
     const exParentId = page.parent;

+ 2 - 4
packages/remark-lsx/src/server/index.ts

@@ -57,9 +57,7 @@ const middleware = (crowi: any, app: any): void => {
     loginRequiredFallback,
   );
   const accessTokenParser = crowi.accessTokenParser;
-  const hideUserPages = crowi.configManager.getConfig(
-    'security:isHidingUserPages',
-  );
+  const excludedPaths = crowi.pageService.getExcludedPathsBySystem();
 
   app.get(
     '/_api/lsx',
@@ -67,7 +65,7 @@ const middleware = (crowi: any, app: any): void => {
     loginRequired,
     lsxValidator,
     paramValidator,
-    listPages(hideUserPages),
+    listPages({ excludedPaths }),
   );
 };