continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r646951 - in /continuum/trunk: continuum-security/src/main/java/org/apache/maven/continuum/security/ continuum-security/src/main/resources/META-INF/redback/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ continuum-web...
Date Thu, 10 Apr 2008 20:44:58 GMT
Author: olamy
Date: Thu Apr 10 13:44:54 2008
New Revision: 646951

URL: http://svn.apache.org/viewvc?rev=646951&view=rev
Log:
[CONTINUUM-1705] Read-only view of the queues
Submitted by Maria Catherine Tan
Note : queues are viewable only for continuum users 

Modified:
    continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
    continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp

Modified: continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java?rev=646951&r1=646950&r2=646951&view=diff
==============================================================================
--- continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
(original)
+++ continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
Thu Apr 10 13:44:54 2008
@@ -115,4 +115,6 @@
     public static final String CONTINUUM_MANAGE_BUILD_TEMPLATES = "continuum-manage-build-templates";
     
     public static final String CONTINUUM_MANAGE_QUEUES = "continuum-manage-queues";
+    
+    public static final String CONTINUUM_VIEW_QUEUES = "continuum-view-queues";
 }

Modified: continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml?rev=646951&r1=646950&r2=646951&view=diff
==============================================================================
--- continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml (original)
+++ continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml Thu
Apr 10 13:44:54 2008
@@ -8,6 +8,11 @@
       <description>Manage Continuum Queues</description>
     </operation>    
     <operation>
+      <id>continuum-view-queues</id>
+      <name>continuum-view-queues</name>
+      <description>Continuum View Queues</description>
+    </operation>
+    <operation>
       <id>continuum-manage-build-templates</id>
       <name>continuum-manage-build-templates</name>
       <description>Manage Continuum Build Definition Templates</description>
@@ -324,6 +329,13 @@
           <operation>continuum-manage-queues</operation>
           <resource>global</resource>
         </permission>
+        <permission>
+          <id>continuum-view-queues</id>
+          <name>Continuum View Queues</name>
+          <permanent>true</permanent>
+          <operation>continuum-view-queues</operation>
+          <resource>global</resource>
+        </permission>
       </permissions>
     </role>   
   </roles>
@@ -496,6 +508,12 @@
           <name>Continuum View Group</name>
           <operation>continuum-view-group</operation>
           <resource>${resource}</resource>
+        </permission>
+        <permission>
+          <id>continuum-view-queues</id>
+          <name>Continuum View Queues</name>
+          <operation>continuum-view-queues</operation>
+          <resource>global</resource>
         </permission>
   	  </permissions>  	  
   	  <parentRoles>

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java?rev=646951&r1=646950&r2=646951&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
Thu Apr 10 13:44:54 2008
@@ -462,6 +462,23 @@
     }
 
     /**
+     * Check if the current user is authorized to manage queues 
+     * 
+     * @throws AuthenticationRequiredException if the user isn't authenticated
+     * @throws AuthorizationRequiredException if the user isn't authorized
+     */
+    protected void checkManageQueuesAuthorization()
+        throws AuthenticationRequiredException, AuthorizationRequiredException
+    {
+        if ( !isAuthenticated() )
+        {
+            throw new AuthenticationRequiredException( "Authentication required" );
+        }
+        
+        checkAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_QUEUES );
+    }
+    
+    /**
      * Get the security session
      *
      * @return current SecuritySession

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java?rev=646951&r1=646950&r2=646951&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
Thu Apr 10 13:44:54 2008
@@ -26,6 +26,8 @@
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.scm.queue.CheckOutTask;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
+import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.redback.rbac.Resource;
 import org.codehaus.plexus.redback.xwork.interceptor.SecureAction;
@@ -82,6 +84,21 @@
     public String cancelCurrent()
         throws Exception
     {
+        try 
+        {
+            checkManageQueuesAuthorization();
+        }
+        catch( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException e )
+        {
+            addActionError( e.getMessage() );
+            return REQUIRES_AUTHENTICATION;
+        }
+        
         cancelBuild( projectId );
         return SUCCESS;
     }
@@ -89,12 +106,42 @@
     public String removeCheckout()
         throws Exception
     {
+        try 
+        {
+            checkManageQueuesAuthorization();
+        }
+        catch( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException e )
+        {
+            addActionError( e.getMessage() );
+            return REQUIRES_AUTHENTICATION;
+        }
+            
         getContinuum().removeProjectFromCheckoutQueue( projectId );
         return SUCCESS;
     }
 
     public String cancelCurrentCheckout()
     {
+        try 
+        {
+            checkManageQueuesAuthorization();
+        }
+        catch( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException e )
+        {
+            addActionError( e.getMessage() );
+            return REQUIRES_AUTHENTICATION;
+        }
+        
         cancelCheckout( projectId );
         return SUCCESS;
     }
@@ -112,6 +159,21 @@
     public String remove()
         throws Exception
     {
+        try 
+        {
+            checkManageQueuesAuthorization();
+        }
+        catch( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException e )
+        {
+            addActionError( e.getMessage() );
+            return REQUIRES_AUTHENTICATION;
+        }
+        
         getContinuum().removeFromBuildingQueue( projectId, buildDefinitionId, trigger, projectName
);
         Project project = getContinuum().getProject( projectId );
         project.setState( project.getOldState() );
@@ -123,6 +185,21 @@
     public String removeBuildEntries()
         throws Exception
     {
+        try 
+        {
+            checkManageQueuesAuthorization();
+        }
+        catch( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException e )
+        {
+            addActionError( e.getMessage() );
+            return REQUIRES_AUTHENTICATION;
+        }
+        
         getContinuum().removeProjectsFromBuildingQueueWithHashCodes( listToIntArray(this.getSelectedBuildTaskHashCodes())
);
         return SUCCESS;
     }
@@ -130,6 +207,21 @@
     public String removeCheckoutEntries()
         throws Exception
     {
+        try 
+        {
+            checkManageQueuesAuthorization();
+        }
+        catch( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException e )
+        {
+            addActionError( e.getMessage() );
+            return REQUIRES_AUTHENTICATION;
+        }
+        
         getContinuum()
             .removeTasksFromCheckoutQueueWithHashCodes( listToIntArray( this.getSelectedCheckOutTaskHashCodes()
) );
         return SUCCESS;
@@ -159,7 +251,7 @@
     {
         SecureActionBundle bundle = new SecureActionBundle();
         bundle.setRequiresAuthentication( true );
-        bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_QUEUES,
Resource.GLOBAL );
+        bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_VIEW_QUEUES, Resource.GLOBAL
);
 
         return bundle;
     }

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp?rev=646951&r1=646950&r2=646951&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp
(original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp
Thu Apr 10 13:44:54 2008
@@ -21,6 +21,7 @@
 <%@ taglib uri="/webwork" prefix="ww" %>
 <%@ taglib uri="continuum" prefix="c1" %>
 <%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
+<%@ taglib uri="http://plexus.codehaus.org/redback/taglib-1.0" prefix="redback" %>
 
 <html>
   <ww:i18n name="localization.Continuum">
@@ -46,10 +47,15 @@
                 <td width="50%"><ww:property value="currentBuildProjectTask.projectName"/></td>
                 <td width="49%"><ww:property value="currentBuildProjectTask.buildDefinitionLabel"/></td>
                 <td width="1%">
+                <redback:ifAuthorized permission="continuum-manage-queues">
                   <ww:url id="cancelUrl" action="cancelCurrentBuildTask" method="cancelCurrent"
namespace="/">
                     <ww:param name="projectId"><ww:property value="currentBuildProjectTask.projectId"/></ww:param>
                   </ww:url>      
                   <ww:a href="%{cancelUrl}"><img src="<ww:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>"
border="0"></ww:a>              
+                </redback:ifAuthorized>
+                <redback:elseAuthorized>
+                  <img src="<ww:url value='/images/cancelbuild_disabled.gif' includeParams="none"/>"
alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>" border="0">
+                </redback:elseAuthorized>
                 </td>
               </tr>
             </tbody>
@@ -72,19 +78,26 @@
                         sortable="false"
                         filterable="false">
                 <ec:row highlightRow="true">
+                  <redback:ifAuthorized permission="continuum-manage-queues">
                   <ec:column alias="selectedBuildTaskHashCodes" title="&nbsp;" style="width:5px"
filterable="false" sortable="false" width="1%" headerCell="selectAll">
                     <input type="checkbox" name="selectedBuildTaskHashCodes" value="${buildProjectTask.hashCode}"
/>
                   </ec:column>              
+                  </redback:ifAuthorized>
                   <ec:column property="projectName" title="buildQueue.currentTask.projectName"
style="white-space: nowrap" width="49%"/>
                   <ec:column property="buildDefinitionLabel" title="buildQueue.currentTask.buildDefinition"
style="white-space: nowrap" width="49%"/>
                   <ec:column property="cancelEntry" title="&nbsp;" width="1%">
+                    <redback:ifAuthorized permission="continuum-manage-queues">
                     <ww:url id="cancelUrl" action="removeBuildQueueEntry" method="remove"
namespace="/">
                       <ww:param name="projectId">${pageScope.buildProjectTask.projectId}</ww:param>
                       <ww:param name="buildDefinitionId">${pageScope.buildProjectTask.buildDefinitionId}</ww:param>
                       <ww:param name="trigger">${pageScope.buildProjectTask.trigger}</ww:param>
                       <ww:param name="projectName">${pageScope.buildProjectTask.projectName}</ww:param>
                     </ww:url>      
-                    <ww:a href="%{cancelUrl}"><img src="<ww:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>"
border="0"></ww:a>    
+                    <ww:a href="%{cancelUrl}"><img src="<ww:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>"
border="0"></ww:a>
+                    </redback:ifAuthorized>
+                    <redback:elseAuthorized>
+                      <img src="<ww:url value='/images/cancelbuild_disabled.gif' includeParams="none"/>"
alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>" border="0">
+                    </redback:elseAuthorized>    
                   </ec:column>             
                 </ec:row>
               </ec:table>
@@ -124,10 +137,15 @@
               <tr>
                 <td width="99%"><ww:property value="currentCheckOutTask.projectName"/></td>
                 <td width="1%">
+                <redback:ifAuthorized permission="continuum-manage-queues">
                   <ww:url id="cancelUrl" action="cancelCurrentQueueTask" method="cancelCurrentCheckout"
namespace="/">
                     <ww:param name="projectId"><ww:property value="currentCheckOutTask.projectId"/></ww:param>
                   </ww:url>      
-                  <ww:a href="%{cancelUrl}"><img src="<ww:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>"
border="0"></ww:a>              
+                  <ww:a href="%{cancelUrl}"><img src="<ww:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>"
border="0"></ww:a>
+                </redback:ifAuthorized>
+                <redback:elseAuthorized>
+                  <img src="<ww:url value='/images/cancelbuild_disabled.gif' includeParams="none"/>"
alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>" border="0">
+                </redback:elseAuthorized>              
                 </td>
               </tr>
             </tbody>
@@ -150,15 +168,22 @@
                         sortable="false"
                         filterable="false">
                 <ec:row highlightRow="true">
+                  <redback:ifAuthorized permission="continuum-manage-queues">
                   <ec:column alias="selectedCheckOutTaskHashCodes" title="&nbsp;"
style="width:5px" filterable="false" sortable="false" width="1%" headerCell="selectAll">
                     <input type="checkbox" name="selectedCheckOutTaskHashCodes" value="${currentCheckOutTask.hashCode}"
/>
                   </ec:column>              
+                  </redback:ifAuthorized>
                   <ec:column property="projectName" title="Project Name" style="white-space:
nowrap" width="98%"/>
                   <ec:column property="cancelEntry" title="&nbsp;" width="1%">
+                  <redback:ifAuthorized permission="continuum-manage-queues">
                     <ww:url id="cancelUrl" action="removeCheckoutQueueEntry" method="removeCheckout">
                       <ww:param name="projectId">${pageScope.currentCheckOutTask.projectId}</ww:param>
                     </ww:url>      
-                    <ww:a href="%{cancelUrl}"><img src="<ww:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>"
border="0"></ww:a>    
+                    <ww:a href="%{cancelUrl}"><img src="<ww:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>"
border="0"></ww:a>
+                  </redback:ifAuthorized>
+                  <redback:elseAuthorized>
+                    <img src="<ww:url value='/images/cancelbuild_disabled.gif' includeParams="none"/>"
alt="<ww:text name='cancel'/>" title="<ww:text name='cancel'/>" border="0">
+                  </redback:elseAuthorized>    
                   </ec:column>             
                 </ec:row>
               </ec:table>
@@ -173,8 +198,10 @@
               <tbody>
                 <tr>
                   <td>
+                    <redback:ifAuthorized permission="continuum-manage-queues">
                     <input type="submit" value="<ww:text name="checkoutQueue.removeEntries"/>"

                            onclick="$('removeForm').action='removeCheckoutQueueEntries!removeCheckoutEntries.action';$('removeForm').submit();"
/>
+                    </redback:ifAuthorized>
                   </td>
                 </tr>
               </tbody>

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp?rev=646951&r1=646950&r2=646951&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp Thu
Apr 10 13:44:54 2008
@@ -82,7 +82,7 @@
   </redback:ifAuthorized>
 
 
-  <redback:ifAnyAuthorized permissions="continuum-manage-build-templates,continuum-manage-schedules,continuum-manage-configuration,continuum-manage-users,continuum-manage-installations,continuum-manage-profiles,continuum-manage-queues">
+  <redback:ifAnyAuthorized permissions="continuum-manage-build-templates,continuum-manage-schedules,continuum-manage-configuration,continuum-manage-users,continuum-manage-installations,continuum-manage-profiles,continuum-view-queues">
     <div id="projectmenu" class="toolgroup">
       <div class="label">
         <ww:text name="menu.administration"/>
@@ -112,7 +112,7 @@
             </ww:a>
           </div> 
         </redback:ifAuthorized> 
-        <redback:ifAuthorized permission="continuum-manage-queues">
+        <redback:ifAuthorized permission="continuum-view-queues">
           <ww:url id="queueUrls" action="displayQueues" namespace="/admin" method="display"
includeParams="none"/>
           <div class="body">
             <ww:a href="%{queueUrls}">



Mime
View raw message