tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manv...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm EditRealmAction.java JDBCRealmForm.java JNDIRealmForm.java MemoryRealmForm.java UserDatabaseRealmForm.java
Date Fri, 03 May 2002 07:19:23 GMT
manveen     02/05/03 00:19:23

  Modified:    webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm
                        EditRealmAction.java JDBCRealmForm.java
                        JNDIRealmForm.java MemoryRealmForm.java
                        UserDatabaseRealmForm.java
  Log:
  Add a check is "delete this realm" operation should be enabled from the realm page. Realms
under the service, host or context same as the admin app should not be deleted.
  
  Revision  Changes    Path
  1.4       +52 -4     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/EditRealmAction.java
  
  Index: EditRealmAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/EditRealmAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EditRealmAction.java	16 Apr 2002 06:00:17 -0000	1.3
  +++ EditRealmAction.java	3 May 2002 07:19:23 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/EditRealmAction.java,v
1.3 2002/04/16 06:00:17 manveen Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/04/16 06:00:17 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/EditRealmAction.java,v
1.4 2002/05/03 07:19:23 manveen Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/05/03 07:19:23 $
    *
    * ====================================================================
    *
  @@ -92,7 +92,7 @@
    * Realm </em> transactions, based on the type of Realm.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.3 $ $Date: 2002/04/16 06:00:17 $
  + * @version $Revision: 1.4 $ $Date: 2002/05/03 07:19:23 $
    */
   
   public class EditRealmAction extends Action {
  @@ -111,6 +111,7 @@
       
       private HttpSession session = null;
       private Locale locale = null;
  +    private HttpServletRequest request = null;
       
       // --------------------------------------------------------- Public Methods
       
  @@ -137,6 +138,7 @@
           
           // Acquire the resources that we need
           session = request.getSession();
  +        this.request = request;
           locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
           if (resources == null) {
               resources = getServlet().getResources();
  @@ -217,6 +219,8 @@
           realmFm.setNodeLabel(sb.toString());
           realmFm.setRealmType(realmType);
           realmFm.setDebugLvlVals(Lists.getDebugLevels());
  +        realmFm.setAllowDeletion(allowDeletion(rname));
  +        
           String attribute = null;
           try {
   
  @@ -254,6 +258,8 @@
           realmFm.setNodeLabel(sb.toString());
           realmFm.setRealmType(realmType);
           realmFm.setDebugLvlVals(Lists.getDebugLevels());
  +        realmFm.setAllowDeletion(allowDeletion(rname));
  +
           String attribute = null;
           try {
   
  @@ -291,6 +297,8 @@
           realmFm.setNodeLabel(sb.toString());
           realmFm.setRealmType(realmType);
           realmFm.setDebugLvlVals(Lists.getDebugLevels());
  +        realmFm.setAllowDeletion(allowDeletion(rname));
  +
           String attribute = null;
           try {
   
  @@ -353,6 +361,8 @@
           realmFm.setRealmType(realmType);
           realmFm.setDebugLvlVals(Lists.getDebugLevels());
           realmFm.setSearchVals(Lists.getBooleanValues());
  +        realmFm.setAllowDeletion(allowDeletion(rname));
  +
           String attribute = null;
           try {
   
  @@ -404,4 +414,42 @@
                                         attribute));
           }     
       }
  +    
  +    /*
  +     * Check if "delete this realm" operation should be enabled.
  +     * this operation is not allowed in case the realm is under service,
  +     * host or context that the admin app runs on.
  +     * return "true" if deletion is allowed.
  +     */
  +     
  +    private String allowDeletion(ObjectName rname) {
  +
  +     boolean retVal = true;
  +     try{
  +        // admin app's values
  +        String adminService = Lists.getAdminAppService(
  +                              mBServer, rname.getDomain(),request);
  +        String adminHost = request.getServerName();                                   
     
  +        String adminContext = request.getContextPath();
  +
  +        String thisService = rname.getKeyProperty("service");
  +        String thisHost = rname.getKeyProperty("host");
  +        String thisContext = rname.getKeyProperty("path");
  +        
  +        // realm is under context
  +        if (thisContext!=null) {
  +            retVal = !(thisContext.equalsIgnoreCase(adminContext));            
  +        } else if (thisHost != null) {
  +            // realm is under host            
  +            retVal = !(thisHost.equalsIgnoreCase(adminHost));
  +        } else {
  +            // realm is under service            
  +            retVal = !(thisService.equalsIgnoreCase(adminService));
  +        }
  +                
  +     } catch (Exception e) {
  +           getServlet().log("Error getting admin service, host or context", e);       
   
  +     }
  +        return new Boolean(retVal).toString();
  +    }    
   }
  
  
  
  1.4       +29 -4     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JDBCRealmForm.java
  
  Index: JDBCRealmForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JDBCRealmForm.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JDBCRealmForm.java	24 Mar 2002 04:13:24 -0000	1.3
  +++ JDBCRealmForm.java	3 May 2002 07:19:23 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JDBCRealmForm.java,v
1.3 2002/03/24 04:13:24 manveen Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/03/24 04:13:24 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JDBCRealmForm.java,v
1.4 2002/05/03 07:19:23 manveen Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/05/03 07:19:23 $
    *
    * ====================================================================
    *
  @@ -76,7 +76,7 @@
    * Form bean for the jdbc realm page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.3 $ $Date: 2002/03/24 04:13:24 $
  + * @version $Revision: 1.4 $ $Date: 2002/05/03 07:19:23 $
    */
   
   public final class JDBCRealmForm extends ActionForm {
  @@ -175,6 +175,12 @@
        */
       private List realmTypeVals = null;
       
  +    /**
  +     * The text for whether "delete this realm" operation is allowed
  +     * on the realm or not.
  +     */
  +    private String allowDeletion = null;
  + 
       // ------------------------------------------------------------- Properties
   
          /**
  @@ -486,7 +492,26 @@
           this.realmTypeVals = realmTypeVals;
           
       }
  +  
  +    /**
  +     * Return the allow deletion value.
  +     */
  +    public String getAllowDeletion() {
  +        
  +        return this.allowDeletion;
  +        
  +    }
       
  +    /**
  +     * Set the allow Deletion value.
  +     */
  +    public void setAllowDeletion(String allowDeletion) {
  +        
  +        this.allowDeletion = allowDeletion;
  +        
  +    }
  +
  +
       // --------------------------------------------------------- Public Methods
       
       /**
  
  
  
  1.4       +28 -4     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JNDIRealmForm.java
  
  Index: JNDIRealmForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JNDIRealmForm.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JNDIRealmForm.java	24 Mar 2002 04:13:24 -0000	1.3
  +++ JNDIRealmForm.java	3 May 2002 07:19:23 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JNDIRealmForm.java,v
1.3 2002/03/24 04:13:24 manveen Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/03/24 04:13:24 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/JNDIRealmForm.java,v
1.4 2002/05/03 07:19:23 manveen Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/05/03 07:19:23 $
    *
    * ====================================================================
    *
  @@ -76,7 +76,7 @@
    * Form bean for the JNDI realm page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.3 $ $Date: 2002/03/24 04:13:24 $
  + * @version $Revision: 1.4 $ $Date: 2002/05/03 07:19:23 $
    */
   
   public final class JNDIRealmForm extends ActionForm {
  @@ -184,6 +184,12 @@
        */
       private List realmTypeVals = null;
       
  +    /**
  +     * The text for whether "delete this realm" operation is allowed
  +     * on the realm or not.
  +     */
  +    private String allowDeletion = null;
  + 
       // ------------------------------------------------------------- Properties
       
          /**
  @@ -551,6 +557,24 @@
           
       }
       
  +    /**
  +     * Return the allow deletion value.
  +     */
  +    public String getAllowDeletion() {
  +        
  +        return this.allowDeletion;
  +        
  +    }
  +    
  +    /**
  +     * Set the allow Deletion value.
  +     */
  +    public void setAllowDeletion(String allowDeletion) {
  +        
  +        this.allowDeletion = allowDeletion;
  +        
  +    }
  +
       // --------------------------------------------------------- Public Methods
       
       /**
  
  
  
  1.4       +28 -4     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/MemoryRealmForm.java
  
  Index: MemoryRealmForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/MemoryRealmForm.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MemoryRealmForm.java	24 Mar 2002 04:13:24 -0000	1.3
  +++ MemoryRealmForm.java	3 May 2002 07:19:23 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/MemoryRealmForm.java,v
1.3 2002/03/24 04:13:24 manveen Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/03/24 04:13:24 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/MemoryRealmForm.java,v
1.4 2002/05/03 07:19:23 manveen Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/05/03 07:19:23 $
    *
    * ====================================================================
    *
  @@ -76,7 +76,7 @@
    * Form bean for the memory realm page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.3 $ $Date: 2002/03/24 04:13:24 $
  + * @version $Revision: 1.4 $ $Date: 2002/05/03 07:19:23 $
    */
   
   public final class MemoryRealmForm extends ActionForm {
  @@ -129,6 +129,12 @@
        */
       private List realmTypeVals = null;
       
  +    /**
  +     * The text for whether "delete this realm" operation is allowed
  +     * on the realm or not.
  +     */
  +    private String allowDeletion = null;
  + 
       // ------------------------------------------------------------- Properties
       
         /**
  @@ -292,6 +298,24 @@
       public void setNodeLabel(String nodeLabel) {
           
           this.nodeLabel = nodeLabel;
  +        
  +    }
  +    
  +    /**
  +     * Return the allow deletion value.
  +     */
  +    public String getAllowDeletion() {
  +        
  +        return this.allowDeletion;
  +        
  +    }
  +    
  +    /**
  +     * Set the allow Deletion value.
  +     */
  +    public void setAllowDeletion(String allowDeletion) {
  +        
  +        this.allowDeletion = allowDeletion;
           
       }
       
  
  
  
  1.4       +29 -5     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/UserDatabaseRealmForm.java
  
  Index: UserDatabaseRealmForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/UserDatabaseRealmForm.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UserDatabaseRealmForm.java	24 Mar 2002 04:13:24 -0000	1.3
  +++ UserDatabaseRealmForm.java	3 May 2002 07:19:23 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/UserDatabaseRealmForm.java,v
1.3 2002/03/24 04:13:24 manveen Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/03/24 04:13:24 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/UserDatabaseRealmForm.java,v
1.4 2002/05/03 07:19:23 manveen Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/05/03 07:19:23 $
    *
    * ====================================================================
    *
  @@ -76,7 +76,7 @@
    * Form bean for the User Database realm page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.3 $ $Date: 2002/03/24 04:13:24 $
  + * @version $Revision: 1.4 $ $Date: 2002/05/03 07:19:23 $
    */
   
   public final class UserDatabaseRealmForm extends ActionForm {
  @@ -129,7 +129,12 @@
        */
       private List realmTypeVals = null;
   
  -    
  +    /**
  +     * The text for whether "delete this realm" operation is allowed
  +     * on the realm or not.
  +     */
  +    private String allowDeletion = null;
  +  
       // ------------------------------------------------------------- Properties
       
        /**
  @@ -294,6 +299,25 @@
           this.realmTypeVals = realmTypeVals;
           
       }
  +    
  +    /**
  +     * Return the allow deletion value.
  +     */
  +    public String getAllowDeletion() {
  +        
  +        return this.allowDeletion;
  +        
  +    }
  +    
  +    /**
  +     * Set the allow Deletion value.
  +     */
  +    public void setAllowDeletion(String allowDeletion) {
  +        
  +        this.allowDeletion = allowDeletion;
  +        
  +    }
  +
       
       // --------------------------------------------------------- Public Methods
       
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message