Merged V3.2 to HEAD

15828: ETHREEOH-2601: Users dialog won't delete users who have no authentication information
      - Moved the AuthenticationService.deleteAuthentication() call inside PersonService.deletePerson() and protected with try - catch so that if there is no authentication information (for an upgraded/moved user) the person can still be deleted
      - Removed a bunch of redundant deleteAuthentication() calls


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15829 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2009-08-20 11:01:19 +00:00
parent f73c72d424
commit 44e72700aa
3 changed files with 3 additions and 43 deletions

View File

@@ -1924,7 +1924,6 @@ error_rule=Failed to create Rule due to error: {0}
error_space=Failed to create new space due to error: {0}
error_person=Failed to create Person due to error: {0}
error_delete_user=Failed to delete User due to error: {0}
error_delete_user_object=Unable to delete the User object associated with the Person. This is not an error if an external authentication mechanism such as NTLM was previously active.
error_remove_user=Failed to remove User due to error: {0}
error_password_match=Please ensure that both password fields contain the same value.
error_property=Property ''{0}'' is not available for this node

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,7 +18,7 @@
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
@@ -34,7 +34,6 @@ import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.ResultSet;
@@ -44,7 +43,6 @@ import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.util.ISO9075;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.LoginBean;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.MapNode;
import org.alfresco.web.bean.repository.Node;
@@ -64,8 +62,6 @@ public class DeleteUserDialog extends BaseDialogBean
private static final String ERROR_DELETE = "error_delete_user";
private static final String ERROR_USER_DELETE = "error_delete_user_object";
private static final String BUTTON_YES = "yes";
private static final String MSG_TITLE_DELETE_USER = "title_delete_user";
@@ -95,22 +91,6 @@ public class DeleteUserDialog extends BaseDialogBean
{
String userName = (String) getPerson().getProperties().get("userName");
// we only delete the user auth if Alfresco is managing the authentication
Map session = context.getExternalContext().getSessionMap();
if (session.get(LoginBean.LOGIN_EXTERNAL_AUTH) == null)
{
// delete the User authentication
try
{
getAuthenticationService().deleteAuthentication(userName);
}
catch (AuthenticationException authErr)
{
Utils.addErrorMessage(Application.getMessage(context, ERROR_USER_DELETE));
ReportedException.throwIfNecessary(authErr);
}
}
// delete the associated Person
getPersonService().deletePerson(userName);

View File

@@ -38,7 +38,6 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.ResultSet;
@@ -49,7 +48,6 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.IContextListener;
import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.bean.LoginBean;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.dialog.ChangeViewSupport;
import org.alfresco.web.bean.repository.MapNode;
@@ -78,9 +76,7 @@ public class UsersDialog extends BaseDialogBean implements IContextListener, Cha
public static final String ERROR_PASSWORD_MATCH = "error_password_match";
public static final String ERROR_NEGATIVE_QUOTA = "error_negative_quota";
private static final String ERROR_DELETE = "error_delete_user";
private static final String ERROR_USER_DELETE = "error_delete_user_object";
private static final String DEFAULT_OUTCOME = "dialog:manageUsers";
private static final String DIALOG_CLOSE = "dialog:close";
private static final String VIEW_DETAILS = "user_details";
@@ -226,22 +222,7 @@ public class UsersDialog extends BaseDialogBean implements IContextListener, Cha
try
{
String userName = (String) properties.getPerson().getProperties().get("userName");
// we only delete the user auth if Alfresco is managing the authentication
Map session = context.getExternalContext().getSessionMap();
if (session.get(LoginBean.LOGIN_EXTERNAL_AUTH) == null)
{
// delete the User authentication
try
{
properties.getAuthenticationService().deleteAuthentication(userName);
}
catch (AuthenticationException authErr)
{
// Let's not worry if authentication details don't exist
}
}
// delete the associated Person
properties.getPersonService().deletePerson(userName);