Fix AWC-367. Deleting a user from the system does not remove that user from any groups they may be in.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2391 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2006-02-15 16:35:40 +00:00
parent 4496b8bfb5
commit a41a792659
2 changed files with 20 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.IContextListener;
import org.alfresco.web.app.context.UIContextService;
@@ -68,6 +69,9 @@ public class UsersBean implements IContextListener
/** AuthenticationService bean reference */
private AuthenticationService authenticationService;
/** PersonService bean reference */
private PersonService personService;
/** Component reference for Users RichList control */
private UIRichList usersRichList;
@@ -120,6 +124,14 @@ public class UsersBean implements IContextListener
this.authenticationService = authenticationService;
}
/**
* @param personService The PersonService to set.
*/
public void setPersonService(PersonService personService)
{
this.personService = personService;
}
/**
* @return Returns the usersRichList.
*/
@@ -267,6 +279,8 @@ public class UsersBean implements IContextListener
tx = Repository.getUserTransaction(context);
tx.begin();
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)
@@ -274,7 +288,7 @@ public class UsersBean implements IContextListener
// delete the User authentication
try
{
authenticationService.deleteAuthentication((String) getPerson().getProperties().get("userName"));
authenticationService.deleteAuthentication(userName);
}
catch (AuthenticationException authErr)
{
@@ -283,7 +297,7 @@ public class UsersBean implements IContextListener
}
// delete the associated Person
this.nodeService.deleteNode(getPerson().getNodeRef());
this.personService.deletePerson(userName);
// commit the transaction
tx.commit();

View File

@@ -194,6 +194,10 @@
<property-name>authenticationService</property-name>
<value>#{authenticationService}</value>
</managed-property>
<managed-property>
<property-name>personService</property-name>
<value>#{personService}</value>
</managed-property>
</managed-bean>
<managed-bean>