continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcconn...@apache.org
Subject svn commit: r450468 - in /maven/continuum/branches/rbac-integration/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ java/org/apache/maven/continuum/web/action/component/ java/org/apache/maven/continuum/web/interceptor/ resources/...
Date Wed, 27 Sep 2006 15:05:26 GMT
Author: jmcconnell
Date: Wed Sep 27 08:05:25 2006
New Revision: 450468

URL: http://svn.apache.org/viewvc?view=rev&rev=450468
Log:
forced configuration works now, you are forced to make and admin users, forced to login and
then forced to edit the configuration...then your good to go

Added:
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/interceptor/
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/interceptor/ForceContinuumConfigurationInterceptor.java
  (with props)
Removed:
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SessionAction.java
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/redirectToContinuumInitialization.jsp
Modified:
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/components/buildDefinitionSummaryComponent.jsp
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/configurationEdit.jsp
    maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/projectGroupBuildDefinition.jsp

Modified: maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java?view=diff&rev=450468&r1=450467&r2=450468
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
(original)
+++ maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
Wed Sep 27 08:05:25 2006
@@ -21,8 +21,13 @@
 import org.apache.maven.continuum.configuration.ConfigurationStoringException;
 import org.apache.maven.continuum.model.system.UserGroup;
 import org.apache.maven.continuum.security.ContinuumSecurity;
+import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
+import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
+import org.codehaus.plexus.security.rbac.Resource;
 
 import java.io.File;
 import java.util.Collections;
@@ -37,7 +42,7 @@
  */
 public class ConfigurationAction
     extends ContinuumActionSupport
-    implements Preparable
+    implements Preparable, SecureAction
 {
 
     /**
@@ -78,7 +83,7 @@
         companyUrl = configuration.getCompanyUrl();
     }
 
-    public String execute()
+    public String save()
         throws ConfigurationStoringException, ContinuumStoreException
     {
         
@@ -120,18 +125,6 @@
         return SUCCESS;
     }
 
-    public String doDefault()
-        throws Exception
-    {
-        return SUCCESS;
-    }
-
-    public String doEdit()
-        throws Exception
-    {
-        return INPUT;
-    }
-
     public boolean isGuestAccountEnabled()
     {
         return guestAccountEnabled;
@@ -200,5 +193,16 @@
     public void setCompanyUrl( String companyUrl )
     {
         this.companyUrl = companyUrl;
+    }
+
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+        bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_CONFIGURATION,
Resource.GLOBAL );
+
+        return bundle;
     }
 }

Modified: maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java?view=diff&rev=450468&r1=450467&r2=450468
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java
(original)
+++ maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java
Wed Sep 27 08:05:25 2006
@@ -40,6 +40,8 @@
 {
     private int projectGroupId;
 
+    private String projectGroupName;
+
     private int projectId;
 
     private List projectBuildDefinitionSummaries = new ArrayList();
@@ -166,6 +168,16 @@
     public void setProjectGroupId( int projectGroupId )
     {
         this.projectGroupId = projectGroupId;
+    }
+
+    public String getProjectGroupName()
+    {
+        return projectGroupName;
+    }
+
+    public void setProjectGroupName( String projectGroupName )
+    {
+        this.projectGroupName = projectGroupName;
     }
 
     public List getProjectBuildDefinitionSummaries()

Added: maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/interceptor/ForceContinuumConfigurationInterceptor.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/interceptor/ForceContinuumConfigurationInterceptor.java?view=auto&rev=450468
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/interceptor/ForceContinuumConfigurationInterceptor.java
(added)
+++ maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/interceptor/ForceContinuumConfigurationInterceptor.java
Wed Sep 27 08:05:25 2006
@@ -0,0 +1,70 @@
+package org.apache.maven.continuum.web.interceptor;
+
+import com.opensymphony.xwork.ActionInvocation;
+import com.opensymphony.xwork.interceptor.Interceptor;
+import org.apache.maven.continuum.Continuum;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * ForceContinuumConfigurationInterceptor:
+ *
+ * @author: Jesse McConnell <jmcconnell@apache.org>
+ * @version: $ID:$
+ * @plexus.component
+ *   role="com.opensymphony.xwork.interceptor.Interceptor"
+ *   role-hint="forceContinuumConfigurationInterceptor"
+ */
+public class ForceContinuumConfigurationInterceptor
+    extends AbstractLogEnabled
+    implements Interceptor
+{
+    private static boolean checked = false;
+
+    /**
+     * @plexus.requirement
+     */
+    private Continuum continuum;
+
+    public void destroy()
+    {
+        // no-op
+    }
+
+    public void init()
+    {
+
+    }
+
+    public String intercept( ActionInvocation invocation )
+        throws Exception
+    {
+        if ( checked )
+        {
+            return invocation.invoke();
+        }
+
+        if ( !continuum.getConfiguration().isInitialized() )
+        {
+            return "continuum-configuration-required";
+        }
+
+        checked = true;
+
+        return invocation.invoke();
+    }
+}

Propchange: maven/continuum/branches/rbac-integration/continuum-webapp/src/main/java/org/apache/maven/continuum/web/interceptor/ForceContinuumConfigurationInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/continuum/branches/rbac-integration/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-webapp/src/main/resources/xwork.xml?view=diff&rev=450468&r1=450467&r2=450468
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-webapp/src/main/resources/xwork.xml
(original)
+++ maven/continuum/branches/rbac-integration/continuum-webapp/src/main/resources/xwork.xml
Wed Sep 27 08:05:25 2006
@@ -11,11 +11,21 @@
 
     <interceptors>
       <interceptor name="exception-logging" class="exceptionLogging"/>
+      <interceptor name="continuumConfigurationCheck" class="forceContinuumConfigurationInterceptor"/>
       <interceptor name="pssForceAdminUser" class="pssForceAdminUserInterceptor"/>
       <interceptor name="pssSecureActions" class="pssSecureActionInterceptor"/>
       <interceptor name="pssEnvironmentChecker" class="pssEnvironmentCheckInterceptor"/>
       
-      <interceptor-stack name="defaultContinuumStack">
+      <interceptor-stack name="configuredContinuumStack">
+        <interceptor-ref name="defaultStack"/>
+        <interceptor-ref name="exception-logging"/>
+        <interceptor-ref name="pssEnvironmentChecker"/>
+        <interceptor-ref name="pssForceAdminUser"/>
+        <interceptor-ref name="pssSecureActions"/>
+        <interceptor-ref name="continuumConfigurationCheck"/>
+      </interceptor-stack>
+
+      <interceptor-stack name="unconfiguredContinuumStack">
         <interceptor-ref name="defaultStack"/>
         <interceptor-ref name="exception-logging"/>
         <interceptor-ref name="pssEnvironmentChecker"/>
@@ -24,18 +34,25 @@
       </interceptor-stack>
     </interceptors>
 
-    <default-interceptor-ref name="defaultContinuumStack"/>
+    <default-interceptor-ref name="configuredContinuumStack"/>
 
     <global-results>
       <result name="error">/error.jsp</result>
       <result name="internalError" type="redirect">/error.jsp</result>
-      <result name="continuumInitialization" type="redirect">/configuration!input.action</result>
+      <result name="continuum-configuration-required" type="redirect-action">
+        <param name="actionName">configuration</param>
+        <param name="method">input</param>
+      </result>
 
        <!-- The following security-* result names arrive from the plexus-security package
-->
       <result name="security-login-success" type="redirect-action">groupSummary</result>
       <result name="security-login-cancel" type="redirect-action">groupSummary</result>
       <result name="security-login-locked" type="redirect-action">groupSummary</result>
       <result name="security-logout" type="redirect-action">groupSummary</result>
+      <result name="requires-authentication" type="redirect-action">
+        <param name="actionName">login</param>
+        <param name="namespace">/security</param>
+      </result>
       <result name="security-register-success" type="redirect-action">
         <param name="actionName">login</param>
         <param name="namespace">/security</param>
@@ -72,11 +89,8 @@
       <result type="redirect-action">groupSummary</result>
     </action>
 
-    <action name="checkConfiguration" class="checkConfiguration">
-      <result name="input">/redirectToContinuumInitialization.jsp</result>
-    </action>
-
     <action name="configuration" class="configuration">
+      <interceptor-ref name="unconfiguredContinuumStack"/>
       <result name="input">configurationEdit.jsp</result>
       <result name="success">configuration.jsp</result>
     </action>

Modified: maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/components/buildDefinitionSummaryComponent.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/components/buildDefinitionSummaryComponent.jsp?view=diff&rev=450468&r1=450467&r2=450468
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/components/buildDefinitionSummaryComponent.jsp
(original)
+++ maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/components/buildDefinitionSummaryComponent.jsp
Wed Sep 27 08:05:25 2006
@@ -1,7 +1,9 @@
 <%@ taglib uri="/webwork" prefix="ww" %>
 <%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
-<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%
 <%@ taglib uri="continuum" prefix="c1" %>
+<%@ taglib uri="/plexusSecuritySystem" prefix="pss" %>
+
 <ww:i18n name="localization.Continuum">
   <ec:table items="allBuildDefinitionSummaries"
             var="buildDefinitionSummary"
@@ -21,30 +23,47 @@
       <ec:column property="actions" title="&nbsp;">
         <!-- if the from is PROJECT then render the links differently -->
         <ww:if test="${pageScope.buildDefinitionSummary.from == 'PROJECT'}">
-          <ww:url id="editUrl" action="buildDefinition" method="input" namespace="/">
-            <ww:param name="projectId">${pageScope.buildDefinitionSummary.projectId}</ww:param>
-            <ww:param name="buildDefinitionId">${pageScope.buildDefinitionSummary.id}</ww:param>
-          </ww:url>
-          <ww:url id="removeUrl" action="removeProjectBuildDefinition" namespace="/">
-            <ww:param name="projectId">${pageScope.buildDefinitionSummary.projectId}</ww:param>
-            <ww:param name="buildDefinitionId">${pageScope.buildDefinitionSummary.id}</ww:param>
-            <ww:param name="confirmed" value="false"/>
-          </ww:url>
+          <pss:ifAuthorized permission="continuum-modify-project-build-definition" resource="${projectGroupName}">
+            <ww:url id="editUrl" action="buildDefinition" method="input" namespace="/">
+              <ww:param name="projectId">${pageScope.buildDefinitionSummary.projectId}</ww:param>
+              <ww:param name="buildDefinitionId">${pageScope.buildDefinitionSummary.id}</ww:param>
+            </ww:url>
+            <ww:a href="%{editUrl}">
+              <ww:text name="edit"/>
+            </ww:a>
+          </pss:ifAuthorized>
+          <pss:ifAuthorized permission="continuum-remove-project-build-definition" resource="${projectGroupName}">
+            <ww:url id="removeUrl" action="removeProjectBuildDefinition" namespace="/">
+              <ww:param name="projectId">${pageScope.buildDefinitionSummary.projectId}</ww:param>
+              <ww:param name="buildDefinitionId">${pageScope.buildDefinitionSummary.id}</ww:param>
+              <ww:param name="confirmed" value="false"/>
+            </ww:url>
+            <ww:a href="%{removeUrl}">
+              <ww:text name="delete"/>
+            </ww:a>
+          </pss:ifAuthorized>
         </ww:if>
         <ww:else>
-          <ww:url id="editUrl" action="buildDefinition" method="input" namespace="/">
-            <ww:param name="projectGroupId">${pageScope.buildDefinitionSummary.projectGroupId}</ww:param>
-            <ww:param name="buildDefinitionId">${pageScope.buildDefinitionSummary.id}</ww:param>
-          </ww:url>
-          <ww:url id="removeUrl" action="removeGroupBuildDefinition" namespace="/">
-            <ww:param name="projectGroupId">${pageScope.buildDefinitionSummary.projectGroupId}</ww:param>
-            <ww:param name="buildDefinitionId">${pageScope.buildDefinitionSummary.id}</ww:param>
-            <ww:param name="confirmed" value="false"/>
-          </ww:url>
+          <pss:ifAuthorized permission="continuum-modify-group-build-definition" resource="${projectGroupName}">
+            <ww:url id="editUrl" action="buildDefinition" method="input" namespace="/">
+              <ww:param name="projectGroupId">${pageScope.buildDefinitionSummary.projectGroupId}</ww:param>
+              <ww:param name="buildDefinitionId">${pageScope.buildDefinitionSummary.id}</ww:param>
+            </ww:url>
+            <ww:a href="%{editUrl}">
+              <ww:text name="edit"/>
+            </ww:a>
+          </pss:ifAuthorized>
+          <pss:ifAuthorized permission="continuum-remove-group-build-definition">
+            <ww:url id="removeUrl" action="removeGroupBuildDefinition" namespace="/">
+              <ww:param name="projectGroupId">${pageScope.buildDefinitionSummary.projectGroupId}</ww:param>
+              <ww:param name="buildDefinitionId">${pageScope.buildDefinitionSummary.id}</ww:param>
+              <ww:param name="confirmed" value="false"/>
+            </ww:url>
+            <ww:a href="%{removeUrl}">
+              <ww:text name="delete"/>
+            </ww:a>
+          </pss:ifAuthorized>
         </ww:else>
-        <ww:a href="%{editUrl}"><ww:text name="edit"/></ww:a>
-        &nbsp;
-        <ww:a href="%{removeUrl}"><ww:text name="delete"/></ww:a>
       </ec:column>
     </ec:row>
   </ec:table>

Modified: maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/configurationEdit.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/configurationEdit.jsp?view=diff&rev=450468&r1=450467&r2=450468
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/configurationEdit.jsp
(original)
+++ maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/configurationEdit.jsp
Wed Sep 27 08:05:25 2006
@@ -9,7 +9,7 @@
   <body>
   <div id="axial" class="h3">
     <h3><ww:text name="configuration.section.title"/></h3>
-    <ww:form action="configuration.action" method="post">
+    <ww:form action="configuration!save" method="post">
 
       <div class="axial">
 

Modified: maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/projectGroupBuildDefinition.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/projectGroupBuildDefinition.jsp?view=diff&rev=450468&r1=450467&r2=450468
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/projectGroupBuildDefinition.jsp
(original)
+++ maven/continuum/branches/rbac-integration/continuum-webapp/src/main/webapp/projectGroupBuildDefinition.jsp
Wed Sep 27 08:05:25 2006
@@ -25,6 +25,7 @@
 
         <ww:action name="groupBuildDefinitionSummary" executeResult="true" namespace="component">
           <ww:param name="projectGroupId" value="%{projectGroupId}"/>
+          <ww:param name="projectGroupName" value="%{projectGroup.name}"/>
         </ww:action>
       </div>
     </body>



Mime
View raw message