We're updating the issue view to help you get more done. 

Userservice plugin leaves user roster items in DB when user is deleted

Description

Quoute form igniterealtime
"I am removing account it is not really removing rosters from that account. Later, when I will add account with same name it has already rosters in his roster list (same as before deleting account)."

Environment

None

Acceptance Test - Entry

None

Activity

Show:
Dele Olajide
December 15, 2013, 3:40 PM

This is the change I am making. To iterate the roster of the user and delete all roster items before deleting the actual user and thereby ensuring DB referential integrity.

public void deleteUser(String username) throws UserNotFoundException, SharedGroupException
{
Roster r = rosterManager.getRoster(username);

Collection<RosterItem> rosterItems = r.getRosterItems();

for (RosterItem rosterItem: rosterItems)
{
r.deleteRosterItem(rosterItem.getJid(), true);
}

User user = getUser(username);
userManager.deleteUser(user);
}

Dele Olajide
December 15, 2013, 5:53 PM
Edited

This works better

public void deleteUser(String username) throws UserNotFoundException, SharedGroupException
{
User user = getUser(username);
userManager.deleteUser(user);

rosterManager.deleteRoster(server.createJID(username, null));
}

Assignee

Dele Olajide

Reporter

Dele Olajide

Labels

None

Expected Effort

None

Ignite Forum URL

None

Components

Fix versions

Affects versions

Due date

2013/12/15

Priority

Major
Configure