From b3a688b0e7f883c2d8f0946e5b76f852bbb63db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20Mo=CC=88ller?= Date: Wed, 15 May 2024 08:13:41 +0200 Subject: [PATCH 1/9] introduce permission for tycho-open-search - fixes: SE-13658 --- .../tycho/search/OpenSearchController.java | 3 ++ src/main/resources/component-070-biz.conf | 3 ++ .../tycho-page-menu/menu.html.pasta | 34 ++++++++++--------- .../wondergem-page-menu/menu.html.pasta | 22 ++++++------ 4 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/main/java/sirius/biz/tycho/search/OpenSearchController.java b/src/main/java/sirius/biz/tycho/search/OpenSearchController.java index 23ca06ec9..e4bf1218b 100644 --- a/src/main/java/sirius/biz/tycho/search/OpenSearchController.java +++ b/src/main/java/sirius/biz/tycho/search/OpenSearchController.java @@ -27,6 +27,7 @@ import sirius.web.controller.Routed; import sirius.web.http.WebContext; import sirius.web.security.LoginRequired; +import sirius.web.security.Permission; import sirius.web.services.JSONStructuredOutput; import java.io.IOException; @@ -119,6 +120,7 @@ public class OpenSearchController extends BizController { */ @Routed("/open-search") @LoginRequired + @Permission("permission-open-search") public void search(WebContext webContext) { webContext.respondWith() .template("/templates/biz/tycho/search/search.html.pasta", webContext.get(PARAM_QUERY).asString()); @@ -132,6 +134,7 @@ public void search(WebContext webContext) { */ @Routed("/open-search/api") @LoginRequired + @Permission("permission-open-search") public Future searchAPI(WebContext webContext) { webContext.markAsLongCall(); diff --git a/src/main/resources/component-070-biz.conf b/src/main/resources/component-070-biz.conf index 142ede7bc..3e2a49810 100644 --- a/src/main/resources/component-070-biz.conf +++ b/src/main/resources/component-070-biz.conf @@ -1432,6 +1432,8 @@ security { permission-view-audit-log : "Required to view the audit log" permission-unlock-files : "Required to unlock read-only files" + permission-open-search : "Required to use the open-search" + feature-bypass-process-log-limits : "Required to bypass log limits of processes via a job parameter" # legacy storage framework... @@ -1462,6 +1464,7 @@ security { permission-view-files = true permission-view-processes = true permission-view-audit-log = true + permission-open-search = true } # If a user belongs to the system tenant, we set the member&affiliate flag diff --git a/src/main/resources/default/extensions/tycho-page-menu/menu.html.pasta b/src/main/resources/default/extensions/tycho-page-menu/menu.html.pasta index 63868e7ee..46261884b 100644 --- a/src/main/resources/default/extensions/tycho-page-menu/menu.html.pasta +++ b/src/main/resources/default/extensions/tycho-page-menu/menu.html.pasta @@ -10,22 +10,24 @@ - - + + + + - + + + Date: Wed, 15 May 2024 08:15:28 +0200 Subject: [PATCH 2/9] use new permission and adjust text/fix wrong wording the link was displayed independent of the active framework tycho.open-search until now - fixes: SE-13658 --- .../templates/biz/tycho/kb/welcome.html.pasta | 18 ++++++++++----- .../biz/tycho/kb/welcome_de.html.pasta | 23 ++++++++++++------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta b/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta index a1c8bb12a..dcf9b64ab 100644 --- a/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta +++ b/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta @@ -1,17 +1,23 @@
- + @sirius.kernel.info.Product.getProduct().getName()

Welcome to the knowledge base of @sirius.kernel.info.Product.getProduct().getName()

- This provides you with an overview of all articles and tutorials we provide. Please note that you can use the - to find articles for a given - keyword. + Here you will find an overview of all the help pages and instructions we provide for you. + Please note that matching articles and tutorials are directly shown in the applications. Lookout for this + symbol in the upper right area. - Also note that matching articles and tutorials are also directly shown in the applications. Lookout for this - symbol im in the upper right area. + + + Also note that you can use the + + to find articles for a given keyword. + + Keep in mind that articles are only visible to authenticated users with the appropriate permissions. If you want to forward a link to an article who doesn't have access to the system, use this button, which will generated diff --git a/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta b/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta index c0571bc7b..f699c6c09 100644 --- a/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta +++ b/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta @@ -1,19 +1,26 @@

- + @sirius.kernel.info.Product.getProduct().getName()

-Willkommen in der Knowledge Base von @sirius.kernel.info.Product.getProduct().getName() + Willkommen in der Knowledge Base von @sirius.kernel.info.Product.getProduct().getName()

- Hier finden Sie eine Übersicht über alle Hilfeseiten und Anleitungen die wir für Sie bereitstellen. Bitte beachten - Sie, dass Sie auch die verwenden - können, um entsprechende Hilfeseiten zu finden. - - Passende Anleitungen oder Erklärungen finden Sie auch direkt in den Anwendungen. Achten Sie hierfür auf dieses + Hier finden Sie eine Übersicht über alle Hilfeseiten und Anleitungen die wir für Sie bereitstellen. + Passende Anleitungen oder Erklärungen finden Sie direkt in den Anwendungen. Achten Sie hierfür auf dieses Symbol im rechten oberen Bereich. - Bitte beachten Sie, dass einige Hilfeseiten nur mit einer entsprechenden Berechtigung und nach einem Login sichtbar + + + Bitte beachten Sie, dass Sie auch die + + verwenden können, um entsprechende Hilfeseiten zu finden. + + + + Bitte beachten Sie, dass einige Hilfeseiten nur mit einer entsprechenden Berechtigung und nach einem Login + sichtbar sind. Wenn Sie eine Hilfeseite an weitere Personen versenden möchten, nutzen Sie hierfür den Button im rechten oberen Bereich.

From fc8b197d5e0ef0d10fccd8c201f9a7c9553fcf1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20Mo=CC=88ller?= Date: Wed, 15 May 2024 08:15:56 +0200 Subject: [PATCH 3/9] autoformat and fix typo - fixes: SE-13658 --- .../sirius/biz/tycho/search/OpenSearchController.java | 2 +- .../default/extensions/tycho-page-menu/menu.html.pasta | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/sirius/biz/tycho/search/OpenSearchController.java b/src/main/java/sirius/biz/tycho/search/OpenSearchController.java index e4bf1218b..90631d352 100644 --- a/src/main/java/sirius/biz/tycho/search/OpenSearchController.java +++ b/src/main/java/sirius/biz/tycho/search/OpenSearchController.java @@ -57,7 +57,7 @@ public class OpenSearchController extends BizController { /** - * Contains the framework which controls of the system wide search / open search is pvoided or not. + * Contains the framework which controls of the system wide search / open search is provided or not. */ public static final String FRAMEWORK_TYCHO_OPEN_SEARCH = "tycho.open-search"; diff --git a/src/main/resources/default/extensions/tycho-page-menu/menu.html.pasta b/src/main/resources/default/extensions/tycho-page-menu/menu.html.pasta index 46261884b..abb279dbc 100644 --- a/src/main/resources/default/extensions/tycho-page-menu/menu.html.pasta +++ b/src/main/resources/default/extensions/tycho-page-menu/menu.html.pasta @@ -36,10 +36,11 @@ active="part(sirius.biz.process.Processes.class).hasActiveProcesses()" link="/ps" permission="permission-view-processes"/> - + Date: Wed, 15 May 2024 08:17:36 +0200 Subject: [PATCH 4/9] fix rendering the templates created in openSearchProviders. the security-sandbox crashed the rendering of the tenant/select links so we disable it here. - fixes: SE-13658 --- .../java/sirius/biz/tycho/search/OpenSearchResult.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/sirius/biz/tycho/search/OpenSearchResult.java b/src/main/java/sirius/biz/tycho/search/OpenSearchResult.java index 15715e8cd..cba2ed5bd 100644 --- a/src/main/java/sirius/biz/tycho/search/OpenSearchResult.java +++ b/src/main/java/sirius/biz/tycho/search/OpenSearchResult.java @@ -14,6 +14,7 @@ import sirius.kernel.health.Exceptions; import sirius.kernel.health.Log; import sirius.pasta.noodle.compiler.CompileException; +import sirius.pasta.noodle.sandbox.SandboxMode; import sirius.pasta.tagliatelle.Tagliatelle; import sirius.pasta.tagliatelle.Template; import sirius.pasta.tagliatelle.compiler.TemplateCompilationContext; @@ -79,8 +80,10 @@ public OpenSearchResult withDescription(String description) { */ public OpenSearchResult withTemplateFromCode(String template, Object... args) { try { - TemplateCompilationContext context = - tagliatelle.createInlineCompilationContext("OpenSearchResult", template, null); + TemplateCompilationContext context = tagliatelle.createInlineCompilationContext("OpenSearchResult", + template, + SandboxMode.DISABLED, + null); TemplateCompiler templateCompiler = new TemplateCompiler(context); templateCompiler.compile(); this.htmlDescription = context.getTemplate().renderToString(args); From 7e863eaa93bac6da0ff0587b9efb503d0c246cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20Mo=CC=88ller?= Date: Wed, 15 May 2024 08:18:10 +0200 Subject: [PATCH 5/9] add missing category-links to the open-search result page they were collected but never used until now - fixes: SE-13658 --- .../default/templates/biz/tycho/search/search.html.pasta | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/default/templates/biz/tycho/search/search.html.pasta b/src/main/resources/default/templates/biz/tycho/search/search.html.pasta index d0a0142f0..d0b99a2c4 100644 --- a/src/main/resources/default/templates/biz/tycho/search/search.html.pasta +++ b/src/main/resources/default/templates/biz/tycho/search/search.html.pasta @@ -75,7 +75,7 @@ if (!_category) { _auxiliary.innerHTML = Mustache.render('' + '
' + - '

{{category}}

' + + ' ' + '
' , node); _category = _auxiliary.childNodes[0]; From 55df48d4799e7dbfa79b9bc32fe9f0ebc2fdaf94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20Mo=CC=88ller?= Date: Wed, 15 May 2024 08:45:39 +0200 Subject: [PATCH 6/9] fix a copy-paste mistake - fixes: SE-13658 --- .../resources/default/templates/biz/tycho/kb/welcome.html.pasta | 2 +- .../default/templates/biz/tycho/kb/welcome_de.html.pasta | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta b/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta index dcf9b64ab..303e471c7 100644 --- a/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta +++ b/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta @@ -12,7 +12,7 @@ symbol in the upper right area. - + Also note that you can use the to find articles for a given keyword. diff --git a/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta b/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta index f699c6c09..57aee228e 100644 --- a/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta +++ b/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta @@ -12,7 +12,7 @@ Symbol im rechten oberen Bereich. - + Bitte beachten Sie, dass Sie auch die verwenden können, um entsprechende Hilfeseiten zu finden. From ad4b63943a2fa3c9501f563e7062d9c4de5a5671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20Mo=CC=88ller?= Date: Wed, 15 May 2024 08:48:28 +0200 Subject: [PATCH 7/9] code-style - fixes: SE-13658 --- .../default/templates/biz/tycho/kb/welcome.html.pasta | 3 ++- .../default/templates/biz/tycho/kb/welcome_de.html.pasta | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta b/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta index 303e471c7..97e7822ba 100644 --- a/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta +++ b/src/main/resources/default/templates/biz/tycho/kb/welcome.html.pasta @@ -1,5 +1,6 @@
- @sirius.kernel.info.Product.getProduct().getName()
diff --git a/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta b/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta index 57aee228e..666778cee 100644 --- a/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta +++ b/src/main/resources/default/templates/biz/tycho/kb/welcome_de.html.pasta @@ -1,5 +1,6 @@
- @sirius.kernel.info.Product.getProduct().getName()
From d09d1c1c0c6f9af1401ab085ed8be6f892ae98d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20Mo=CC=88ller?= Date: Wed, 15 May 2024 09:01:35 +0200 Subject: [PATCH 8/9] adjust styling and add external-link icon - fixes: SE-13658 --- .../default/templates/biz/tycho/search/search.html.pasta | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/default/templates/biz/tycho/search/search.html.pasta b/src/main/resources/default/templates/biz/tycho/search/search.html.pasta index d0b99a2c4..f1493728d 100644 --- a/src/main/resources/default/templates/biz/tycho/search/search.html.pasta +++ b/src/main/resources/default/templates/biz/tycho/search/search.html.pasta @@ -75,7 +75,7 @@ if (!_category) { _auxiliary.innerHTML = Mustache.render('' + '
' + - ' ' + + '

{{category}}

' + '
' , node); _category = _auxiliary.childNodes[0]; From ed23eb2cc5d80847a8398433dba1abf5ba121542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20Mo=CC=88ller?= Date: Wed, 15 May 2024 09:03:28 +0200 Subject: [PATCH 9/9] switch order of user-accounts and tenants in the search-results - fixes: SE-13658 --- src/main/java/sirius/biz/tenants/TenantSearchProvider.java | 2 +- src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/sirius/biz/tenants/TenantSearchProvider.java b/src/main/java/sirius/biz/tenants/TenantSearchProvider.java index b248ad1a7..55871b34e 100644 --- a/src/main/java/sirius/biz/tenants/TenantSearchProvider.java +++ b/src/main/java/sirius/biz/tenants/TenantSearchProvider.java @@ -83,6 +83,6 @@ public void query(String query, int maxResults, Consumer resul @Override public int getPriority() { - return 110; + return 100; } } diff --git a/src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java b/src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java index 0ced63345..545e9c1b2 100644 --- a/src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java +++ b/src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java @@ -111,6 +111,6 @@ public void query(String query, int maxResults, Consumer resul @Override public int getPriority() { - return 100; + return 110; } }