From f327eb9b2493e8250e87847d0b167827bcad16df Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Wed, 26 Oct 2016 23:29:11 +0200 Subject: [PATCH] Add admin user check after system configuration change --- .../js/archiva/admin/features/generaladmin/main.js | 12 ++++++++++-- .../src/main/webapp/js/archiva/main.js | 5 +++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js index 8d3269ee1..95ed9f3da 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js @@ -1358,7 +1358,15 @@ define("archiva/admin/features/generaladmin/main",["jquery","jquery.ui","i18n"," self.redbackRuntimeConfiguration().rbacManagerImpls.push(beanId); } - + var adminAvailableResponseFn = function(adminExists) { + $.log("admin exists "+adminExists); + if (adminExists) { + window.sammyArchivaApplication.runRoute("get","#redbackruntimeconfig"); + } else { + logout(); + displayWelcome(); + } + } $.log("rememberme enabled:"+self.redbackRuntimeConfiguration().findPropertyValue("security.rememberme.enabled")); $.ajax("restServices/archivaServices/redbackRuntimeConfigurationService/redbackRuntimeConfiguration", { @@ -1368,7 +1376,7 @@ define("archiva/admin/features/generaladmin/main",["jquery","jquery.ui","i18n"," dataType: 'json', success: function(data) { var message=$.i18n.prop('redback-runtime-configuration.updated'); - window.sammyArchivaApplication.runRoute("get","#redbackruntimeconfig"); + checkCreateAdminLink(adminAvailableResponseFn); displaySuccessMessage(message); }, error: function(data) { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index cd3f09250..1d7dc714d 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -825,14 +825,15 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa } else { createAdminLink.hide(); } - if(callbackFn){ - callbackFn() + if(callbackFn) { + callbackFn(adminExists) } $.log("adminExists:"+adminExists); } }); }; + // handle url with registration link checkUrlParams=function(){ var validateMeId = $.urlParam('validateMe'); -- 2.39.5