From d48d471d91d30d9383525b56633203a53997021c Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 16 Feb 2011 13:43:39 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50713 Remove roles command from Manager application git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1071243 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/ant/RolesTask.java | 56 -------------------- java/org/apache/catalina/ant/antlib.xml | 3 -- java/org/apache/catalina/ant/catalina.tasks | 1 - .../catalina/manager/LocalStrings.properties | 1 - .../catalina/manager/LocalStrings_de.properties | 1 - .../catalina/manager/LocalStrings_es.properties | 1 - .../catalina/manager/LocalStrings_fr.properties | 1 - .../catalina/manager/LocalStrings_ja.properties | 1 - .../apache/catalina/manager/ManagerServlet.java | 61 ---------------------- webapps/docs/changelog.xml | 11 +++- webapps/docs/html-manager-howto.xml | 5 -- webapps/docs/manager-howto.xml | 61 ---------------------- webapps/manager/WEB-INF/web.xml | 14 ----- 13 files changed, 10 insertions(+), 207 deletions(-) delete mode 100644 java/org/apache/catalina/ant/RolesTask.java diff --git a/java/org/apache/catalina/ant/RolesTask.java b/java/org/apache/catalina/ant/RolesTask.java deleted file mode 100644 index a3e4d034c..000000000 --- a/java/org/apache/catalina/ant/RolesTask.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.catalina.ant; - - -import org.apache.tools.ant.BuildException; - - -/** - * Ant task that implements the /roles command, supported by the - * Tomcat manager application. - * - * @author Craig R. McClanahan - * @version $Id$ - * @since 4.1 - */ -public class RolesTask extends AbstractCatalinaTask { - - - // ------------------------------------------------------------- Properties - - - // --------------------------------------------------------- Public Methods - - - /** - * Execute the requested operation. - * - * @exception BuildException if an error occurs - */ - @Override - public void execute() throws BuildException { - - super.execute(); - execute("/roles"); - - } - - -} diff --git a/java/org/apache/catalina/ant/antlib.xml b/java/org/apache/catalina/ant/antlib.xml index 0c5e36ab8..5923ec070 100644 --- a/java/org/apache/catalina/ant/antlib.xml +++ b/java/org/apache/catalina/ant/antlib.xml @@ -35,9 +35,6 @@ name="undeploy" classname="org.apache.catalina.ant.UndeployTask" /> - /resources?type=xxxx - Enumerate the available global JNDI * resources, optionally limited to those of the specified type * (fully qualified Java class name), if available. - *
  • /roles - Enumerate the available security role names and - * descriptions from the user database connected to the users - * resource reference. *
  • /serverinfo - Display system OS and JVM properties. *
  • /sessions - Deprecated. Use expire. *
  • /expire?path=/xxx - List session idle timeinformation about the @@ -362,8 +354,6 @@ public class ManagerServlet extends HttpServlet implements ContainerServlet { reload(writer, cn, smClient); } else if (command.equals("/resources")) { resources(writer, type, smClient); - } else if (command.equals("/roles")) { - roles(writer, smClient); } else if (command.equals("/save")) { save(writer, path, smClient); } else if (command.equals("/serverinfo")) { @@ -1034,57 +1024,6 @@ public class ManagerServlet extends HttpServlet implements ContainerServlet { /** - * Render a list of security role names (and corresponding descriptions) - * from the org.apache.catalina.UserDatabase resource that is - * connected to the users resource reference. Typically, this - * will be the global user database, but can be adjusted if you have - * different user databases for different virtual hosts. - * - * @param writer Writer to render to - */ - protected void roles(PrintWriter writer, StringManager smClient) { - - if (debug >= 1) { - log("roles: List security roles from user database"); - } - - // Look up the UserDatabase instance we should use - UserDatabase database = null; - try { - InitialContext ic = new InitialContext(); - database = (UserDatabase) ic.lookup("java:comp/env/users"); - } catch (NamingException e) { - writer.println(smClient.getString( - "managerServlet.userDatabaseError")); - log("java:comp/env/users", e); - return; - } - if (database == null) { - writer.println(smClient.getString( - "managerServlet.userDatabaseMissing")); - return; - } - - // Enumerate the available roles - writer.println(smClient.getString("managerServlet.rolesList")); - Iterator roles = database.getRoles(); - if (roles != null) { - while (roles.hasNext()) { - Role role = roles.next(); - writer.print(role.getRolename()); - writer.print(':'); - if (role.getDescription() != null) { - writer.print(role.getDescription()); - } - writer.println(); - } - } - - - } - - - /** * Writes System OS and JVM properties. * @param writer Writer to render to */ diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 2dc466c54..0b5047074 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -113,10 +113,19 @@ + + + + 50713: Remove roles command from the Manager application. + (markt) + + + - 1068549 50667: Allow RPC callers to get confirmation when sending a reply. + 1068549 50667: Allow RPC callers to get + confirmation when sending a reply. (fhanik) diff --git a/webapps/docs/html-manager-howto.xml b/webapps/docs/html-manager-howto.xml index f8cd40252..6fd0c4303 100644 --- a/webapps/docs/html-manager-howto.xml +++ b/webapps/docs/html-manager-howto.xml @@ -388,11 +388,6 @@ Tomcat server.xml configuration file. Here is an example for Tomcat running on Windows:

    <Context path="/foobar" docBase="C:\path\to\application\foobar"> - - <!-- Link to the user database we will get roles from --> - <ResourceLink name="users" global="UserDatabase" - type="org.apache.catalina.UserDatabase"/> - </Context> diff --git a/webapps/docs/manager-howto.xml b/webapps/docs/manager-howto.xml index a4fe9864b..cfa9f2be0 100644 --- a/webapps/docs/manager-howto.xml +++ b/webapps/docs/manager-howto.xml @@ -58,7 +58,6 @@ the following functions:

  • List the available global JNDI resources, for use in deployment tools that are preparing <ResourceLink> elements nested in a <Context> deployment description.
  • -
  • List the available security roles defined in the user database.
  • Start a stopped application (thus making it available again).
  • Stop an existing application (so that it becomes unavailable), but do not undeploy it.
  • @@ -390,11 +389,6 @@ Tomcat server.xml configuration file. Here is an example:

    <Context path="/foobar" docBase="/path/to/application/foobar"> - - <!-- Link to the user database we will get roles from --> - <ResourceLink name="users" global="UserDatabase" - type="org.apache.catalina.UserDatabase"/> - </Context> @@ -652,60 +646,6 @@ include an error message. Possible causes for problems include:

    - - - - -http://localhost:8080/manager/text/roles - - -

    List the security role names (and corresponding descriptions) that are -available in the org.apache.catalina.UserDatabase resource that -is linked to the users resource reference in the web.xml file -for the Manager web application. This would typically be used, for example, -by a deployment tool that wanted to create -<security-role-ref> elements to map security role names -used in a web application to the role names actually defined within the -container.

    - -

    By default, the users resource reference is pointed at the -global UserDatabase resource. If you choose to utilize a -different user database per virtual host, you should modify the -<ResourceLink> element in the default -manager.xml context configuration file to point at the global -user database resource for this virtual host.

    - -

    When this command is executed, the first line of the response will be:

    -
    -  OK - Listed security roles
    -
    -

    followed by one line for each security role. Each line is composed of -fields delimited by colon characters (":") as follows:

    -
      -
    • Security Role Name - A security role name that is known to Tomcat - in the user database.
    • -
    • Description - Description of this security role (useful in - creating user interfaces for selecting roles.
    • -
    - -

    If an error occurs, the response will start with FAIL and -include an error message. Possible causes for problems include:

    -
      -
    • Cannot resolve user database reference - A JNDI error prevented - the successful lookup of the org.apache.catalina.UserDatabase - resource. Check the Tomcat log files for a stack trace associated with - this error.
    • -
    • No user database is available - You have not configured a resource - reference for the users resource that points at an - appropriate user database instance. Check your manager.xml - file and ensure that you have created an appropriate - <ResourceLink> or - <ResourceParams> element for this resource.
    • -
    - -
    - - @@ -996,7 +936,6 @@ file might look something like this:

    <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/> <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/> <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"/> - <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"/> <taskdef name="start" classname="org.apache.catalina.ant.StartTask"/> <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/> <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/> diff --git a/webapps/manager/WEB-INF/web.xml b/webapps/manager/WEB-INF/web.xml index e23e226d5..2d13269ba 100644 --- a/webapps/manager/WEB-INF/web.xml +++ b/webapps/manager/WEB-INF/web.xml @@ -105,20 +105,6 @@ jsp - - - - Link to the UserDatabase instance from which we request lists of - defined role names. Typically, this will be connected to the global - user database with a ResourceLink element in server.xml or the context - configuration file for the Manager web application. - - users - - org.apache.catalina.UserDatabase - - - -- 2.11.0