Author: dimuthul
Date: Thu Jan 10 21:06:19 2008
New Revision: 12126
Log:
Fixing an issue - where all properties should be allowed set.
Modified:
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/DefaultUserStoreAdmin.java
trunk/commons/usermanager/modules/core/src/test/java/org/wso2/usermanager/readwrite/DefaultRealmTest.java
Modified:
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/DefaultUserStoreAdmin.java
==============================================================================
---
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/DefaultUserStoreAdmin.java
(original)
+++
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/DefaultUserStoreAdmin.java
Thu Jan 10 21:06:19 2008
@@ -33,19 +33,19 @@
public void addUser(String userName, Object credential)
throws UserManagerException {
-
- if(userName == null || credential == null){
+
+ if (userName == null || credential == null) {
throw new UserManagerException("nullData");
}
-
+
if (!(credential instanceof String)) {
throw new UserManagerException("credentialTypeNotSupport");
}
-
- if(userName.trim().length() == 0){
+
+ if (userName.trim().length() == 0) {
throw new UserManagerException("nullUser");
}
-
+
Connection dbConnection = null;
try {
dbConnection = dataSource.getConnection();
@@ -145,7 +145,7 @@
if (dbConnection == null) {
throw new UserManagerException("null_connection");
}
-
+
PreparedStatement updateUserStmt = dbConnection
.prepareStatement(data
.getUserStoreAdminSQL(DefaultRealmConstants.UPDATE_USER));
@@ -209,9 +209,6 @@
throw new UserManagerException("nullUser");
}
- if (properties == null || properties.isEmpty()) {
- return;
- }
Connection dbConnection = null;
try {
dbConnection = dataSource.getConnection();
@@ -228,18 +225,20 @@
.prepareStatement(data
.getUserStoreAdminSQL(DefaultRealmConstants.ADD_USER_ATTRIBUTE));
- Iterator ite = properties.entrySet().iterator();
- while (ite.hasNext()) {
- Entry entry = (Entry) ite.next();
- String key = (String) entry.getKey();
- String value = (String) entry.getValue();
- if (value != null) {
- String idUserAttribute = UUIDGenerator.getUUID();
- setUserPropertiesStmt.setString(1, key);
- setUserPropertiesStmt.setString(2, value);
- setUserPropertiesStmt.setString(3, userid);
- setUserPropertiesStmt.setString(4, idUserAttribute);
- setUserPropertiesStmt.executeUpdate();
+ if (properties != null) {
+ Iterator ite = properties.entrySet().iterator();
+ while (ite.hasNext()) {
+ Entry entry = (Entry) ite.next();
+ String key = (String) entry.getKey();
+ String value = (String) entry.getValue();
+ if (value != null) {
+ String idUserAttribute = UUIDGenerator.getUUID();
+ setUserPropertiesStmt.setString(1, key);
+ setUserPropertiesStmt.setString(2, value);
+ setUserPropertiesStmt.setString(3, userid);
+ setUserPropertiesStmt.setString(4, idUserAttribute);
+ setUserPropertiesStmt.executeUpdate();
+ }
}
}
dbConnection.commit();
Modified:
trunk/commons/usermanager/modules/core/src/test/java/org/wso2/usermanager/readwrite/DefaultRealmTest.java
==============================================================================
---
trunk/commons/usermanager/modules/core/src/test/java/org/wso2/usermanager/readwrite/DefaultRealmTest.java
(original)
+++
trunk/commons/usermanager/modules/core/src/test/java/org/wso2/usermanager/readwrite/DefaultRealmTest.java
Thu Jan 10 21:06:19 2008
@@ -284,6 +284,7 @@
admin.addUserToRole("jennifer", "waiter");
admin.addUserToRole("sam", "cook");
+
//david is a cook and a theif
admin.addUserToRole("david", "cook");
admin.addUserToRole("david", "hora2");
_______________________________________________
Commons-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev