2012/4/5 kfuj...@apache.org:
Author: kfujino
Date: Thu Apr 5 10:08:38 2012
New Revision: 1309734
URL: http://svn.apache.org/viewvc?rev=1309734view=rev
Log:
Add new attributes of enabled and disabled to UserConfig.
The name enabled is usually used for a boolean attribute that
disables a feature as a whole.
Maybe name the new attributes as enabledUser and disabledUser ?
Modified:
tomcat/trunk/java/org/apache/catalina/startup/UserConfig.java
tomcat/trunk/webapps/docs/config/listeners.xml
Modified: tomcat/trunk/java/org/apache/catalina/startup/UserConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/UserConfig.java?rev=1309734r1=1309733r2=1309734view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/UserConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/UserConfig.java Thu Apr 5
10:08:38 2012
@@ -25,6 +25,7 @@ import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
+import java.util.regex.Pattern;
import org.apache.catalina.Context;
import org.apache.catalina.Host;
@@ -99,6 +100,15 @@ public final class UserConfig
private String userClass =
org.apache.catalina.startup.PasswdUserDatabase;
+ /**
+ * A regular expression defining user who deployment is allowed.
+ */
+ protected Pattern enabled = null;
+
+ /**
+ * A regular expression defining user who deployment is denied.
+ */
+ protected Pattern disabled = null;
// -
Properties
@@ -210,6 +220,50 @@ public final class UserConfig
}
+ /**
+ * Return the regular expression used to test for user who deployment is
allowed.
+ */
+ public String getEnabled() {
+ if (enabled == null) return null;
+ return enabled.toString();
+ }
+
+
+ /**
+ * Set the regular expression used to test for user who deployment is
allowed.
+ *
+ * @param enabled The new enabled expression
+ */
+ public void setEnabled(String enabled) {
+ if (enabled == null || enabled.length() == 0) {
+ this.enabled = null;
+ } else {
+ this.enabled = Pattern.compile(enabled);
+ }
+ }
+
+
+ /**
+ * Return the regular expression used to test for user who deployment is
denied.
+ */
+ public String getDisabled() {
+ if (disabled == null) return null;
+ return disabled.toString();
+ }
+
+
+ /**
+ * Set the regular expression used to test for user who deployment is
denied.
+ *
+ * @param disabled The new disabled expression
+ */
+ public void setDisabled(String disabled) {
+ if (disabled == null || disabled.length() == 0) {
+ this.disabled = null;
+ } else {
+ this.disabled = Pattern.compile(disabled);
+ }
+ }
// - Public
Methods
@@ -270,6 +324,7 @@ public final class UserConfig
while (users.hasMoreElements()) {
String user = users.nextElement();
String home = database.getHome(user);
+ if (!isDeployEnabled(user)) continue;
It can be moved up by one line.
The home value is not needed to call isDeployEnabled().
results.add(executor.submit(new DeployUserDirectory(this, user,
home)));
}
@@ -348,6 +403,26 @@ public final class UserConfig
}
Best regards,
Konstantin Kolinko
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org