From c3a315669bf563b853461889a61c40128bcc6661 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 21 Feb 2013 14:37:13 +0000 Subject: [PATCH] change dynamically rbacmanagers used git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1448659 13f79535-47bb-0310-9956-ffa450edef68 --- .../web/security/ArchivaRbacManager.java | 31 +++++++++++++++++++ .../main/webapp/js/archiva/general-admin.js | 16 +++++++--- pom.xml | 2 +- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java index f2e21d133..28080185f 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java @@ -20,6 +20,7 @@ package org.apache.archiva.web.security; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.runtime.RedbackRuntimeConfigurationAdmin; +import org.apache.archiva.redback.components.cache.Cache; import org.apache.archiva.redback.rbac.AbstractRBACManager; import org.apache.archiva.redback.rbac.Operation; import org.apache.archiva.redback.rbac.Permission; @@ -35,12 +36,14 @@ import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; import javax.inject.Inject; +import javax.inject.Named; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Set; /** * @author Olivier Lamy @@ -60,6 +63,34 @@ public class ArchivaRbacManager @Inject private RedbackRuntimeConfigurationAdmin redbackRuntimeConfigurationAdmin; + @Inject + @Named( value = "cache#operations" ) + private Cache operationsCache; + + @Inject + @Named( value = "cache#permissions" ) + private Cache permissionsCache; + + @Inject + @Named( value = "cache#resources" ) + private Cache resourcesCache; + + @Inject + @Named( value = "cache#roles" ) + private Cache rolesCache; + + @Inject + @Named( value = "cache#userAssignments" ) + private Cache userAssignmentsCache; + + @Inject + @Named( value = "cache#userPermissions" ) + private Cache>> userPermissionsCache; + + @Inject + @Named( value = "cache#effectiveRoleSet" ) + private Cache> effectiveRoleSetCache; + @Override public void initialize() { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js index f72db41b3..6df885ca8 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js @@ -18,7 +18,7 @@ */ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid", "knockout.sortable","jquery.ui","jquery.validate","bootstrap","select2"] - , function(jquery,i18n,utils,jqueryTmpl,ko) { + , function(jquery,i18n,utils,jqueryTmpl,ko,simpleGrid,sortable,jqueryUi,validate,bootstrap,select2) { //------------------------- // legacy path part @@ -595,6 +595,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" }); } + ArchivaRuntimeConfigurationViewModel=function(archivaRuntimeConfiguration){ var self=this; this.archivaRuntimeConfiguration=ko.observable(archivaRuntimeConfiguration); @@ -617,11 +618,15 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" success: function(data){ displaySuccessMessage( $.i18n.prop("archiva.runtime-configuration.updated")); }, - complete: function(){ - removeMediumSpinnerImg(userMessages); - mainContent.find("#cache-failure-form-btn-save" ).button('reset'); + error:function(){ + displayErrorMessage("error.500"); } - }); + } ).always( + function(){ + removeMediumSpinnerImg(userMessages); + mainContent.find("#cache-failure-form-btn-save" ).button('reset'); + } + ); } } @@ -1750,6 +1755,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } displayRedbackRuntimeConfiguration=function(){ + var jqueryUi = require("jquery.ui"); $.log("displayRuntimeConfiguration"); var mainContent = $("#main-content"); mainContent.html(mediumSpinnerImg()); diff --git a/pom.xml b/pom.xml index 2b41bb619..8cf338362 100644 --- a/pom.xml +++ b/pom.xml @@ -100,7 +100,7 @@ 1.1 2.0 3.0.8 - 2.1-SNAPSHOT + 2.1 7.0.37 clean install -- 2.39.5