java/code/src/com/redhat/rhn/frontend/action/channel/manage/ChannelPackagesRemoveAction.java
| 1
java/code/src/com/redhat/rhn/manager/user/CreateUserCommand.java
| 18 ++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
New commits:
commit 2dabdc268e97fbde25cb5b200a1a02fab322a56d
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Wed Jan 13 18:06:01 2010 +0100
unused import removed
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/ChannelPackagesRemoveAction.java
b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/ChannelPackagesRemoveAction.java
index 920b298..cff825a 100644
---
a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/ChannelPackagesRemoveAction.java
+++
b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/ChannelPackagesRemoveAction.java
@@ -19,7 +19,6 @@ import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.security.PermissionException;
import com.redhat.rhn.domain.channel.Channel;
import com.redhat.rhn.domain.channel.ChannelFactory;
-import com.redhat.rhn.domain.rhnpackage.PackageFactory;
import com.redhat.rhn.domain.rhnset.RhnSet;
import com.redhat.rhn.domain.role.RoleFactory;
import com.redhat.rhn.domain.user.User;
commit fa26c9f9b57824c05cfb72ab4279a84474d1a011
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Wed Jan 13 18:04:23 2010 +0100
513716 - prefix validation added when creating a user
diff --git a/java/code/src/com/redhat/rhn/manager/user/CreateUserCommand.java
b/java/code/src/com/redhat/rhn/manager/user/CreateUserCommand.java
index b213931..0785f60 100644
--- a/java/code/src/com/redhat/rhn/manager/user/CreateUserCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/user/CreateUserCommand.java
@@ -16,6 +16,7 @@ package com.redhat.rhn.manager.user;
import com.redhat.rhn.common.conf.Config;
import com.redhat.rhn.common.hibernate.LookupException;
+import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.messaging.MessageQueue;
import com.redhat.rhn.common.validator.RequiredConstraint;
import com.redhat.rhn.common.validator.ValidatorError;
@@ -30,6 +31,7 @@ import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.List;
+import java.util.SortedSet;
import java.util.regex.Pattern;
import javax.mail.internet.AddressException;
@@ -76,6 +78,7 @@ public class CreateUserCommand {
}
validateEmail();
validateLogin();
+ validatePrefix();
return (ValidatorError[]) errors.toArray(new ValidatorError[0]);
}
@@ -211,6 +214,21 @@ public class CreateUserCommand {
}
/**
+ * Private helper method to validate the user's prefix. Puts errors into the
+ * errors list.
+ */
+ private void validatePrefix() {
+ // Make sure set prefix is valid
+ SortedSet validPrefixes = LocalizationService.getInstance().availablePrefixes();
+ if (!LocalizationService.getInstance().availablePrefixes().contains(
+ user.getPrefix())) {
+ errors.add(new ValidatorError(
+ "Invalid prefix [" + user.getPrefix() + "]. Must be
one of " +
+ validPrefixes.toString()));
+ }
+ }
+
+ /**
* Private helper method to validate the password. This happens when the setPassword
* method of this class is called. Puts errors into the passwordErrors list.
* @param passwordIn The password to check.
Show replies by date