continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r510547 [3/3] - in /maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action: ./ component/ notifier/
Date Thu, 22 Feb 2007 15:24:51 GMT
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractProjectNotifierEditAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractProjectNotifierEditAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractProjectNotifierEditAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractProjectNotifierEditAction.java
Thu Feb 22 07:24:47 2007
@@ -20,11 +20,10 @@
  */
 
 import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
-import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -118,25 +117,25 @@
         this.projectGroupId = projectGroupId;
     }
 
-    protected boolean isAuthorized()
-        throws AuthorizationRequiredException, AuthenticationRequiredException, ContinuumException
+    protected void checkAuthorization()
+        throws AuthorizationRequiredException, ContinuumException
     {
-        if( getNotifier() == null )
+        if ( getNotifier() == null )
         {
-            return isAuthorizedAddProjectNotifier( getProjectGroupName() );
+            checkAddProjectNotifierAuthorization( getProjectGroupName() );
         }
         else
         {
-            return isAuthorizedModifyProjectNotifier( getProjectGroupName() );
+            checkModifyProjectNotifierAuthorization( getProjectGroupName() );
         }
     }
 
     public String getProjectGroupName()
         throws ContinuumException
     {
-        if( projectGroupName == null || "".equals( projectGroupName ) )
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
         {
-            if( projectGroupId != 0 )
+            if ( projectGroupId != 0 )
             {
                 projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
             }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddGroupNotifierAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddGroupNotifierAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddGroupNotifierAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddGroupNotifierAction.java
Thu Feb 22 07:24:47 2007
@@ -22,14 +22,12 @@
  * under the License.
  */
 
+import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
-import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.security.ContinuumRoleConstants;
-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.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * WW action that sets up a new {@link ProjectNotifier} instance for
@@ -42,9 +40,7 @@
  */
 public class AddGroupNotifierAction
     extends ContinuumActionSupport
-    implements SecureAction
 {
-
     /**
      * Target {@link ProjectGroup} instance to add the Notifier for.
      */
@@ -66,6 +62,15 @@
     public String execute()
         throws ContinuumException
     {
+        try
+        {
+            checkAddProjectGroupNotifierAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
 
         return notifierType + "_" + INPUT;
     }
@@ -73,8 +78,17 @@
     public String doDefault()
         throws ContinuumException
     {
+        try
+        {
+            checkAddProjectGroupNotifierAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
 
-        return INPUT;           
+        return INPUT;
     }
 
     /**
@@ -122,30 +136,11 @@
     public String getProjectGroupName()
         throws ContinuumException
     {
-        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        if ( StringUtils.isEmpty( projectGroupName ) )
         {
             projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
         }
 
         return projectGroupName;
     }
-
-     public SecureActionBundle getSecureActionBundle()
-        throws SecureActionException {
-        SecureActionBundle bundle = new SecureActionBundle();
-        bundle.setRequiresAuthentication( true );
-
-        try
-        {
-            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_GROUP_NOTIFIER_OPERATION,
-                    getProjectGroupName() );
-        }
-        catch ( ContinuumException e )
-        {
-            throw new SecureActionException( e.getMessage() );
-        }
-
-        return bundle;
-    }
-
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddProjectNotifierAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddProjectNotifierAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddProjectNotifierAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddProjectNotifierAction.java
Thu Feb 22 07:24:47 2007
@@ -19,15 +19,13 @@
  * under the License.
  */
 
+import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
-import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.security.ContinuumRoleConstants;
-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.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * Action to add a {@link ProjectNotifier} for a specified {@link Project}.
@@ -39,7 +37,6 @@
  */
 public class AddProjectNotifierAction
     extends ContinuumActionSupport
-    implements SecureAction
 {
     /**
      * Identifier for the {@link Project} instance.
@@ -55,7 +52,7 @@
      * Type for a {@link ProjectNotifier}.
      */
     private String notifierType;
-    
+
     /**
      * Detemines if the save operation returns to the project group notifier page or not.<p>
      * <code>true</code> implies return to the project group notifier page.
@@ -73,6 +70,16 @@
     public String execute()
         throws ContinuumException
     {
+        try
+        {
+            checkAddProjectNotifierAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+
         return notifierType + "_" + INPUT;
     }
 
@@ -82,6 +89,16 @@
     public String doDefault()
         throws ContinuumException
     {
+        try
+        {
+            checkAddProjectNotifierAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+
         return INPUT;
     }
 
@@ -167,9 +184,9 @@
     public String getProjectGroupName()
         throws ContinuumException
     {
-        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        if ( StringUtils.isEmpty( projectGroupName ) )
         {
-            if( projectGroupId != 0 )
+            if ( projectGroupId != 0 )
             {
                 projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
             }
@@ -180,23 +197,5 @@
         }
 
         return projectGroupName;
-    }
-
-     public SecureActionBundle getSecureActionBundle()
-        throws SecureActionException {
-        SecureActionBundle bundle = new SecureActionBundle();
-        bundle.setRequiresAuthentication( true );
-
-        try
-        {
-            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_NOTIFIER_OPERATION,
-                    getProjectGroupName() );
-        }
-        catch ( ContinuumException e )
-        {
-            throw new SecureActionException( e.getMessage() );
-        }
-
-        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteGroupNotifierAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteGroupNotifierAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteGroupNotifierAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteGroupNotifierAction.java
Thu Feb 22 07:24:47 2007
@@ -20,13 +20,12 @@
  */
 
 import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.codehaus.plexus.util.StringUtils;
 
 import java.util.Map;
 
@@ -41,9 +40,7 @@
  */
 public class DeleteGroupNotifierAction
     extends ContinuumActionSupport
-    implements SecureAction
 {
-
     private int projectGroupId;
 
     private int notifierId;
@@ -57,6 +54,15 @@
     public String execute()
         throws ContinuumException
     {
+        try
+        {
+            checkRemoveProjectGroupNotifierAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
 
         getContinuum().removeGroupNotifier( projectGroupId, notifierId );
 
@@ -66,6 +72,15 @@
     public String doDefault()
         throws ContinuumException
     {
+        try
+        {
+            checkRemoveProjectGroupNotifierAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
 
         ProjectNotifier notifier = getContinuum().getGroupNotifier( projectGroupId, notifierId
);
 
@@ -147,31 +162,13 @@
     }
 
     public String getProjectGroupName()
-            throws ContinuumException
+        throws ContinuumException
     {
-        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        if ( StringUtils.isEmpty( projectGroupName ) )
         {
             projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
         }
 
         return projectGroupName;
-    }
-
-     public SecureActionBundle getSecureActionBundle()
-        throws SecureActionException {
-        SecureActionBundle bundle = new SecureActionBundle();
-        bundle.setRequiresAuthentication( true );
-
-        try
-        {
-            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_NOTIFIER_OPERATION,
-                    getProjectGroupName() );
-        }
-        catch ( ContinuumException e )
-        {
-            throw new SecureActionException( e.getMessage() );
-        }
-
-        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteProjectNotifierAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteProjectNotifierAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteProjectNotifierAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteProjectNotifierAction.java
Thu Feb 22 07:24:47 2007
@@ -20,14 +20,12 @@
  */
 
 import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.codehaus.plexus.util.StringUtils;
 
 import java.util.Map;
 
@@ -40,9 +38,7 @@
  */
 public class DeleteProjectNotifierAction
     extends ContinuumActionSupport
-    implements SecureAction
 {
-
     private int projectId;
 
     /**
@@ -63,6 +59,15 @@
     public String execute()
         throws ContinuumException
     {
+        try
+        {
+            checkRemoveProjectNotifierAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
 
         getContinuum().removeNotifier( projectId, notifierId );
 
@@ -77,6 +82,15 @@
     public String doDefault()
         throws ContinuumException
     {
+        try
+        {
+            checkRemoveProjectNotifierAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
 
         ProjectNotifier notifier = getContinuum().getNotifier( projectId, notifierId );
 
@@ -102,7 +116,6 @@
             recipient = recipient + ":" + (String) configuration.get( "channel" );
         }
 
-
         return "delete";
     }
 
@@ -169,9 +182,9 @@
     public String getProjectGroupName()
         throws ContinuumException
     {
-        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        if ( StringUtils.isEmpty( projectGroupName ) )
         {
-            if( projectGroupId != 0 )
+            if ( projectGroupId != 0 )
             {
                 projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
             }
@@ -182,23 +195,5 @@
         }
 
         return projectGroupName;
-    }
-
-     public SecureActionBundle getSecureActionBundle()
-        throws SecureActionException {
-        SecureActionBundle bundle = new SecureActionBundle();
-        bundle.setRequiresAuthentication( true );
-
-        try
-        {
-            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_NOTIFIER_OPERATION,
-                    getProjectGroupName() );
-        }
-        catch ( ContinuumException e )
-        {
-            throw new SecureActionException( e.getMessage() );
-        }
-
-        return bundle;
     }
 }



Mime
View raw message