}
}
public User removeUser(String userName, boolean broadcast) throws Exception
{
IdentitySession session = service_.getIdentitySession();
org.picketlink.idm.api.User foundUser = null;
try
{
foundUser = session.getPersistenceManager().findUser(userName);
}
catch (IdentityException e)
{
log.info("Cannot obtain user: " + userName + "; ", e);
}
if (foundUser == null)
{
return null;
}
try
{
// Remove all memberships and profile first
orgService.getMembershipHandler().removeMembershipByUser(userName, false);
orgService.getUserProfileHandler().removeUserProfile(userName, false);
}
catch (Exception e)
{
log.info("Cannot cleanup user relationships: " + userName + "; ", e);
}
User exoUser = getPopulatedUser(userName, session);
if (broadcast)
{
preDelete(exoUser);
}
try
{
session.getPersistenceManager().removeUser(foundUser, true);
}
catch (IdentityException e)
{
log.info("Cannot remove user: " + userName + "; ", e);