From 781c294599f7e3d2cfd01fb0deeb8a39b7a32850 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 23 Nov 2012 09:29:18 +0000 Subject: [PATCH] return updated user and un comment tested code git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1412794 13f79535-47bb-0310-9956-ffa450edef68 --- .../security/LockedAdminEnvironmentCheck.java | 2 +- .../redback/users/jdo/JdoUserManager.java | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/LockedAdminEnvironmentCheck.java b/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/LockedAdminEnvironmentCheck.java index 8780670f..3e9b881c 100644 --- a/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/LockedAdminEnvironmentCheck.java +++ b/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/LockedAdminEnvironmentCheck.java @@ -71,7 +71,7 @@ public class LockedAdminEnvironmentCheck */ public void validateEnvironment( List violations ) { - if ( !checked ) //&& !userManager.isReadOnly() ) + if ( !checked && !userManager.isReadOnly() ) { List roles = new ArrayList(); roles.add( RedbackRoleConstants.SYSTEM_ADMINISTRATOR_ROLE ); diff --git a/redback-users/redback-users-providers/redback-users-jdo/src/main/java/org/apache/archiva/redback/users/jdo/JdoUserManager.java b/redback-users/redback-users-providers/redback-users-jdo/src/main/java/org/apache/archiva/redback/users/jdo/JdoUserManager.java index 80c36db5..c5513921 100644 --- a/redback-users/redback-users-providers/redback-users-jdo/src/main/java/org/apache/archiva/redback/users/jdo/JdoUserManager.java +++ b/redback-users/redback-users-providers/redback-users-jdo/src/main/java/org/apache/archiva/redback/users/jdo/JdoUserManager.java @@ -21,6 +21,8 @@ package org.apache.archiva.redback.users.jdo; import org.apache.archiva.redback.components.jdo.JdoFactory; import org.apache.archiva.redback.components.jdo.PlexusJdoUtils; +import org.apache.archiva.redback.components.jdo.PlexusObjectNotFoundException; +import org.apache.archiva.redback.components.jdo.PlexusStoreException; import org.apache.archiva.redback.policy.UserSecurityPolicy; import org.apache.archiva.redback.users.AbstractUserManager; import org.apache.archiva.redback.users.PermanentUserException; @@ -28,8 +30,6 @@ import org.apache.archiva.redback.users.User; import org.apache.archiva.redback.users.UserManagerException; import org.apache.archiva.redback.users.UserNotFoundException; import org.apache.archiva.redback.users.UserQuery; -import org.apache.archiva.redback.components.jdo.PlexusObjectNotFoundException; -import org.apache.archiva.redback.components.jdo.PlexusStoreException; import org.codehaus.plexus.util.StringUtils; import org.jpox.JDOClassLoaderResolver; import org.springframework.stereotype.Service; @@ -49,14 +49,13 @@ import java.util.List; * JdoUserManager * * @author Joakim Erdfelt - * */ -@Service( "userManager#jdo" ) +@Service ("userManager#jdo") public class JdoUserManager extends AbstractUserManager { @Inject - @Named( value = "jdoFactory#users" ) + @Named (value = "jdoFactory#users") private JdoFactory jdoFactory; @Inject @@ -105,7 +104,7 @@ public class JdoUserManager return getAllObjectsDetached( ordering ); } - @SuppressWarnings( "unchecked" ) + @SuppressWarnings ("unchecked") private List getAllObjectsDetached( String ordering ) { return PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), JdoUser.class, ordering, (String) null ); @@ -126,7 +125,7 @@ public class JdoUserManager return findUsers( "email", emailKey, orderAscending ); } - @SuppressWarnings( "unchecked" ) + @SuppressWarnings ("unchecked") public List findUsersByQuery( UserQuery userQuery ) { JdoUserQuery uq = (JdoUserQuery) userQuery; @@ -170,7 +169,7 @@ public class JdoUserManager } } - @SuppressWarnings( "unchecked" ) + @SuppressWarnings ("unchecked") private List findUsers( String searchField, String searchKey, boolean ascendingUsername ) { PersistenceManager pm = getPersistenceManager(); @@ -377,7 +376,7 @@ public class JdoUserManager userSecurityPolicy.extensionChangePassword( user, passwordChangeRequired ); } - updateObject( user ); + user = (User) updateObject( user ); fireUserManagerUserUpdated( user );