[Yanel-commits] rev 31616 -
public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources
michi at wyona.com
michi at wyona.com
Mon Feb 11 16:11:07 CET 2008
Author: michi
Date: 2008-02-11 16:11:06 +0100 (Mon, 11 Feb 2008)
New Revision: 31616
Modified:
public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/YanelUserResource.java
Log:
group commented and password confirmed added
Modified: public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/YanelUserResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/YanelUserResource.java 2008-02-11 14:55:49 UTC (rev 31615)
+++ public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/YanelUserResource.java 2008-02-11 15:11:06 UTC (rev 31616)
@@ -91,7 +91,8 @@
properties.put("userName", "");
properties.put("email", "");
properties.put("password", "");
- properties.put("group", "");
+ properties.put("passwordConfirmed", "");
+ //properties.put("group", "");
}
@@ -247,14 +248,16 @@
um.createUser(userId, userName, email, password);
+ // TODO: Handle more than one group
String groupId = request.getParameter("rp.group");
- GroupManager gm = getRealm().getIdentityManager().getGroupManager();
- Group group = gm.getGroup(groupId);
- group.addMember(um.getUser(userId));
- group.save();
+ if (groupId != null) {
+ GroupManager gm = getRealm().getIdentityManager().getGroupManager();
+ Group group = gm.getGroup(groupId);
+ group.addMember(um.getUser(userId));
+ group.save();
+ }
- // TODO: Handle more than one group
- saveUserPolicy(userId);
+ //saveUserPolicy(userId);
} else {
log.error("Unable to create user: the data introduced was not valid");
}
@@ -521,6 +524,7 @@
/**
* Saves the user data access policies to the policies repository
*/
+/*
private void saveUserPolicy(String userId) {
Configuration policyConfig = createPolicyConfiguration(userId);
DefaultConfigurationSerializer serializer = new DefaultConfigurationSerializer();
@@ -535,6 +539,7 @@
log.error(e.getMessage(), e);
}
}
+*/
/**
* Validate the supplied user data. userName is optional
@@ -546,15 +551,26 @@
isValid = false;
log.error("No password supplied");
}
+ if (request.getParameter("rp.passwordConfirmed").equals("")) {
+ isValid = false;
+ log.error("No password supplied");
+ }
+ if (!request.getParameter("rp.passwordConfirmed").equals(request.getParameter("rp.password"))) {
+ isValid = false;
+ log.error("Password and confirmed password do no match");
+ }
if (request.getParameter("rp.userId").equals("")) {
isValid = false;
log.error("No userId supplied");
}
+
+/*
String group = request.getParameter("rp.group");
if (group.equals("") || !realm.getIdentityManager().getGroupManager().existsGroup(group)) {
isValid = false;
log.error("Either no group was supplied or the group does not exist");
}
+*/
if (!validateEmail(request.getParameter("rp.email"))) {
isValid = false;
log.error("No email supplied or email not valid");
More information about the Yanel-commits
mailing list