Browse files

XX-10359 - can't change username

  • Loading branch information...
1 parent ccd9adb commit 497153957217122dd768687e880f88296da05d03 @laurentiu laurentiu committed with dizzy Aug 17, 2012
View
4 sipXcommons/src/main/java/org/sipfoundry/commons/userdb/profile/UserProfileService.java
@@ -30,7 +30,9 @@
Integer getUserIdByImId(String imId);
- boolean isImIdInUse(String imId, String username);
+ boolean isAliasInUse(String alias, String username);
+
+ boolean isImIdInUse(String imId, Integer userId);
boolean isImIdInUse(String imId);
View
13 sipXcommons/src/main/java/org/sipfoundry/commons/userdb/profile/UserProfileServiceImpl.java
@@ -77,15 +77,24 @@ public Integer getUserIdByImId(String imId) {
}
@Override
- public boolean isImIdInUse(String imId, String username) {
- UserProfile userProfile = getUserProfileByImId(imId);
+ public boolean isAliasInUse(String alias, String username) {
+ UserProfile userProfile = getUserProfileByImId(alias);
if (userProfile != null && !userProfile.getUserName().equals(username)) {
return true;
}
return false;
}
@Override
+ public boolean isImIdInUse(String imId, Integer userId) {
+ UserProfile userProfile = getUserProfileByImId(imId);
+ if (userProfile != null && !userProfile.getUserId().equals(userId.toString())) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
public boolean isImIdInUse(String imId) {
UserProfile userProfile = getUserProfileByImId(imId);
if (userProfile != null) {
View
4 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/common/CoreContextImpl.java
@@ -744,7 +744,7 @@ public int getBranchMembersCount(int branchId) {
public boolean isImIdUnique(User user) {
ImAccount accountToSave = new ImAccount(user);
// check ImId to save against persisted ImIds
- if (getUserProfileService().isImIdInUse(accountToSave.getImId(), user.getUserName())) {
+ if (getUserProfileService().isImIdInUse(accountToSave.getImId(), user.getId())) {
return false;
}
@@ -789,7 +789,7 @@ public boolean isAliasInUseForOthers(String alias, String username) {
return true;
}
// check im id in user profile db
- return getUserProfileService().isImIdInUse(alias, username);
+ return getUserProfileService().isAliasInUse(alias, username);
}
@Override
View
2 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/common/CoreContextImplTestIntegration.java
@@ -22,8 +22,6 @@
import org.sipfoundry.sipxconfig.branch.Branch;
import org.sipfoundry.sipxconfig.branch.BranchManager;
import org.sipfoundry.sipxconfig.common.SpecialUser.SpecialUserType;
-import org.sipfoundry.sipxconfig.commserver.imdb.ImdbTestCase;
-import org.sipfoundry.sipxconfig.commserver.imdb.MongoTestCaseHelper;
import org.sipfoundry.sipxconfig.permission.PermissionManager;
import org.sipfoundry.sipxconfig.permission.PermissionName;
import org.sipfoundry.sipxconfig.setting.Group;
View
2 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/phonebook/UserProfileTestIntegration.java
@@ -54,7 +54,7 @@ public void testSaveUser() throws Exception {
assertEquals("alttest@test.org", profile.getAlternateEmailAddress());
assertEquals("First ImId", profile.getImDisplayName());
assertTrue(getUserProfileService().isImIdInUse("imid"));
- assertFalse(getUserProfileService().isImIdInUse("imid", "2001"));
+ assertFalse(getUserProfileService().isImIdInUse("imid", userId));
}
public void testDeleteUser() throws Exception {
View
1 sipXconfig/web/context/WEB-INF/user/EditUser.properties
@@ -3,3 +3,4 @@ quick.help=Select <em>Phones</em> to add this user to one or more phones.
invalid.branch=User group branch is inherited. Specific user branch cannot be different
msg.error.renameAdminUser=superadmin user can't be renamed
error.changePintokenRequiredException = When changing user name, you must also change PIN
+duplicate.imid.error=An user with the instant messaging id {0} already exists

0 comments on commit 4971539

Please sign in to comment.