From 6fee2f195fa1d7749803e5e8e6531466cdb0ab72 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 16 Dec 2013 01:26:30 +0000 Subject: [PATCH] implements findUser with useCache method git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551100 13f79535-47bb-0310-9956-ffa450edef68 --- .../ArchivaConfigurableUsersManager.java | 19 ++++++++++++++----- .../archiva/web/rss/SecuritySystemStub.java | 8 ++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java index 0cc1a4e89..652b5d088 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java @@ -188,12 +188,12 @@ public class ArchivaConfigurableUsersManager } } - public User findUser( String username ) - throws UserManagerException + @Override + public User findUser( String username, boolean useCache ) + throws UserNotFoundException, UserManagerException { - User user = null; - if ( useUsersCache() ) + if ( useUsersCache() && useCache ) { user = usersCache.get( username ); if ( user != null ) @@ -242,6 +242,12 @@ public class ArchivaConfigurableUsersManager return user; } + public User findUser( String username ) + throws UserManagerException + { + return findUser( username, useUsersCache() ); + } + @Override public User getGuestUser() @@ -365,7 +371,10 @@ public class ArchivaConfigurableUsersManager public User updateUser( User user ) throws UserNotFoundException, UserManagerException { - user = userManagerPerId.get( user.getUserManagerId() ).updateUser( user ); + + UserManager userManager = userManagerPerId.get( user.getUserManagerId() ); + + user = userManager.updateUser( user ); if ( useUsersCache() ) { diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java index 4b3bec808..f38a0d6a6 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java @@ -32,6 +32,7 @@ import org.apache.archiva.redback.system.SecuritySession; import org.apache.archiva.redback.system.SecuritySystem; import org.apache.archiva.redback.users.User; import org.apache.archiva.redback.users.UserManager; +import org.apache.archiva.redback.users.UserManagerException; import org.apache.archiva.redback.users.UserManagerListener; import org.apache.archiva.redback.users.UserNotFoundException; import org.apache.archiva.redback.users.UserQuery; @@ -359,6 +360,13 @@ public class SecuritySystemStub return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override + public User findUser( String username, boolean useCache ) + throws UserNotFoundException, UserManagerException + { + return null; + } + public User getGuestUser() throws UserNotFoundException {