From 60cefae09a950693f7da99e2b92dbb68db13894b Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 30 Mar 2021 13:10:27 +0200 Subject: [PATCH] Merge pull request #3836 from overleaf/jpa-no-close-editor-in-saas [views] admin: the open/close editor feature is not available in SAAS GitOrigin-RevId: 6d9ba22e7843be7c27084a6bb5bc1c502ecdccc9 --- .../web/app/src/infrastructure/Features.js | 2 ++ services/web/app/src/router.js | 32 +++++++++--------- services/web/app/views/admin/index.pug | 33 ++++++++++--------- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/services/web/app/src/infrastructure/Features.js b/services/web/app/src/infrastructure/Features.js index 2e235f5fbc..148aee0619 100644 --- a/services/web/app/src/infrastructure/Features.js +++ b/services/web/app/src/infrastructure/Features.js @@ -52,6 +52,8 @@ const Features = { */ hasFeature(feature) { switch (feature) { + case 'saas': + return Boolean(Settings.overleaf) case 'homepage': return Boolean(Settings.enableHomepage) case 'registration': diff --git a/services/web/app/src/router.js b/services/web/app/src/router.js index 1bbbdbb3e3..ce3b5496b8 100644 --- a/services/web/app/src/router.js +++ b/services/web/app/src/router.js @@ -943,21 +943,23 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) { AuthorizationMiddleware.ensureUserIsSiteAdmin, UserController.register ) - webRouter.post( - '/admin/openEditor', - AuthorizationMiddleware.ensureUserIsSiteAdmin, - AdminController.openEditor - ) - webRouter.post( - '/admin/closeEditor', - AuthorizationMiddleware.ensureUserIsSiteAdmin, - AdminController.closeEditor - ) - webRouter.post( - '/admin/disconnectAllUsers', - AuthorizationMiddleware.ensureUserIsSiteAdmin, - AdminController.disconnectAllUsers - ) + if (!Features.hasFeature('saas')) { + webRouter.post( + '/admin/openEditor', + AuthorizationMiddleware.ensureUserIsSiteAdmin, + AdminController.openEditor + ) + webRouter.post( + '/admin/closeEditor', + AuthorizationMiddleware.ensureUserIsSiteAdmin, + AdminController.closeEditor + ) + webRouter.post( + '/admin/disconnectAllUsers', + AuthorizationMiddleware.ensureUserIsSiteAdmin, + AdminController.disconnectAllUsers + ) + } webRouter.post( '/admin/flushProjectToTpds', AuthorizationMiddleware.ensureUserIsSiteAdmin, diff --git a/services/web/app/views/admin/index.pug b/services/web/app/views/admin/index.pug index bec1bdbe52..9a59ee53a9 100644 --- a/services/web/app/views/admin/index.pug +++ b/services/web/app/views/admin/index.pug @@ -35,23 +35,26 @@ block content li(ng-non-bindable) #{agent} tab(heading="Open/Close Editor") - .row-spaced - form(method='post',action='/admin/closeEditor') - input(name="_csrf", type="hidden", value=csrfToken) - button.btn.btn-danger(type="submit") Close Editor - p.small Will stop anyone opening the editor. Will NOT disconnect already connected users. + if hasFeature('saas') + | The "Open/Close Editor" feature is not available in SAAS. + else + .row-spaced + form(method='post',action='/admin/closeEditor') + input(name="_csrf", type="hidden", value=csrfToken) + button.btn.btn-danger(type="submit") Close Editor + p.small Will stop anyone opening the editor. Will NOT disconnect already connected users. - .row-spaced - form(method='post',action='/admin/disconnectAllUsers') - input(name="_csrf", type="hidden", value=csrfToken) - button.btn.btn-danger(type="submit") Disconnect all users - p.small Will force disconnect all users with the editor open. Make sure to close the editor first to avoid them reconnecting. + .row-spaced + form(method='post',action='/admin/disconnectAllUsers') + input(name="_csrf", type="hidden", value=csrfToken) + button.btn.btn-danger(type="submit") Disconnect all users + p.small Will force disconnect all users with the editor open. Make sure to close the editor first to avoid them reconnecting. - .row-spaced - form(method='post',action='/admin/openEditor') - input(name="_csrf", type="hidden", value=csrfToken) - button.btn.btn-danger(type="submit") Reopen Editor - p.small Will reopen the editor after closing. + .row-spaced + form(method='post',action='/admin/openEditor') + input(name="_csrf", type="hidden", value=csrfToken) + button.btn.btn-danger(type="submit") Reopen Editor + p.small Will reopen the editor after closing. tab(heading="TPDS/Dropbox Management") h3 Flush project to TPDS