diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/manageproxies/ManageProxiesCreatePage.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/manageproxies/ManageProxiesCreatePage.java index f2b655efe..86459891c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/manageproxies/ManageProxiesCreatePage.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/manageproxies/ManageProxiesCreatePage.java @@ -98,24 +98,28 @@ public class ManageProxiesCreatePage extends AbstractPageHandler { return valid; } - /** We don't remove any existing relationships, we just add new ones. */ + /** + * We don't remove any existing relationships, we just add new ones. But we + * won't add a relationship to one's self. + */ public void createRelationships() { for (UserAccount proxyAccount : proxyAccounts) { Set profiles = new HashSet(); - profiles.addAll(proxyAccount.getProxiedIndividualUris()); profiles.addAll(figureNonSelfProfileUris(proxyAccount)); + profiles.addAll(proxyAccount.getProxiedIndividualUris()); proxyAccount.setProxiedIndividualUris(profiles); userAccountsDao.updateUserAccount(proxyAccount); } } + /* Look at the desired profiles, and remove any that are this proxy's self. */ private Collection figureNonSelfProfileUris(UserAccount proxyAccount) { - List mySelves = selfEditingConfiguration - .getAssociatedIndividuals(indDao, proxyAccount); - List myProfiles = new ArrayList(profileUris); - myProfiles.removeAll(mySelves); + for (Individual self : selfEditingConfiguration + .getAssociatedIndividuals(indDao, proxyAccount)) { + myProfiles.remove(self.getURI()); + } return myProfiles; }