X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui.workbench%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Fworkbench%2Finternal%2Fuseradmin%2Fcommands%2FNewUser.java;h=c342342dc48904c37e565d5aad19ec1ac215f5f7;hb=4153677129487fe302e0c89171179faba4e563e1;hp=c259153f6f243bed2655a9e597dfe089b461b473;hpb=23b7a170cae60b500e9d45551f26b5075eba73a4;p=lgpl%2Fargeo-commons.git
diff --git a/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/internal/useradmin/commands/NewUser.java b/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/internal/useradmin/commands/NewUser.java
index c259153f6..c342342dc 100644
--- a/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/internal/useradmin/commands/NewUser.java
+++ b/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/internal/useradmin/commands/NewUser.java
@@ -25,12 +25,13 @@ import javax.naming.ldap.Rdn;
import org.argeo.cms.CmsException;
import org.argeo.cms.ui.workbench.WorkbenchUiPlugin;
+import org.argeo.cms.ui.workbench.internal.useradmin.UiAdminUtils;
import org.argeo.cms.ui.workbench.internal.useradmin.UserAdminWrapper;
-import org.argeo.cms.util.useradmin.UserAdminUtils;
+import org.argeo.cms.util.UserAdminUtils;
import org.argeo.eclipse.ui.EclipseUiUtils;
import org.argeo.eclipse.ui.dialogs.ErrorFeedback;
+import org.argeo.naming.LdapAttrs;
import org.argeo.node.ArgeoNames;
-import org.argeo.osgi.useradmin.LdifName;
import org.argeo.osgi.useradmin.UserAdminConf;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
@@ -54,13 +55,6 @@ import org.osgi.service.useradmin.UserAdminEvent;
/** Open a wizard that enables creation of a new user. */
public class NewUser extends AbstractHandler {
- /**
- * Email addresses must match this regexp pattern ({@value #EMAIL_PATTERN}.
- * Thanks to this tip.
- */
- public final static String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
// private final static Log log = LogFactory.getLog(NewUser.class);
public final static String ID = WorkbenchUiPlugin.PLUGIN_ID + ".newUser";
@@ -115,20 +109,20 @@ public class NewUser extends AbstractHandler {
String lastNameStr = lastNameTxt.getText();
if (EclipseUiUtils.notEmpty(lastNameStr))
- props.put(LdifName.sn.name(), lastNameStr);
+ props.put(LdapAttrs.sn.name(), lastNameStr);
String firstNameStr = firstNameTxt.getText();
if (EclipseUiUtils.notEmpty(firstNameStr))
- props.put(LdifName.givenName.name(), firstNameStr);
+ props.put(LdapAttrs.givenName.name(), firstNameStr);
String cn = UserAdminUtils.buildDefaultCn(firstNameStr,
lastNameStr);
if (EclipseUiUtils.notEmpty(cn))
- props.put(LdifName.cn.name(), cn);
+ props.put(LdapAttrs.cn.name(), cn);
String mailStr = primaryMailTxt.getText();
if (EclipseUiUtils.notEmpty(mailStr))
- props.put(LdifName.mail.name(), mailStr);
+ props.put(LdapAttrs.mail.name(), mailStr);
char[] password = mainUserInfo.getPassword();
user.getCredentials().put(null, password);
@@ -236,7 +230,7 @@ public class NewUser extends AbstractHandler {
.getRole(getDn(name));
if (role != null)
return "User " + name + " already exists";
- if (!primaryMailTxt.getText().matches(EMAIL_PATTERN))
+ if (!primaryMailTxt.getText().matches(UiAdminUtils.EMAIL_PATTERN))
return "Not a valid email address";
if (lastNameTxt.getText().trim().equals(""))
return "Specify a last name";
@@ -279,7 +273,7 @@ public class NewUser extends AbstractHandler {
if (EclipseUiUtils.notEmpty(bdn)) {
Dictionary props = UserAdminConf.uriAsProperties(dns
.get(bdn));
- String dn = LdifName.uid.name() + "=" + uid + ","
+ String dn = LdapAttrs.uid.name() + "=" + uid + ","
+ UserAdminConf.userBase.getValue(props) + "," + bdn;
return dn;
}
@@ -325,4 +319,4 @@ public class NewUser extends AbstractHandler {
public void setUserAdminWrapper(UserAdminWrapper userAdminWrapper) {
this.userAdminWrapper = userAdminWrapper;
}
-}
\ No newline at end of file
+}