continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r509415 [2/3] - in /maven/continuum/trunk: continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ continuum-webapp/src/main/java/org/apache/maven/c...
Date Tue, 20 Feb 2007 02:41:40 GMT
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java Mon Feb 19 18:41:37 2007
@@ -25,6 +25,8 @@
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.web.bean.ProjectGroupUserBean;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
 import org.codehaus.plexus.rbac.profile.RoleProfileException;
 import org.codehaus.plexus.rbac.profile.RoleProfileManager;
 import org.codehaus.plexus.security.rbac.RBACManager;
@@ -111,7 +113,22 @@
     public String summary()
         throws ContinuumException
     {
-        projectGroup = getContinuum().getProjectGroup( projectGroupId );
+        try
+        {
+            if( isAuthorizedViewProjectGroup( getProjectGroupName() ) )
+            {
+                projectGroup = getProjectGroup( projectGroupId );
+            }
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }
 
         return SUCCESS;
     }
@@ -119,11 +136,26 @@
     public String members()
         throws ContinuumException
     {
-        projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId );
+        try
+        {
+            projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId );
 
-        groupProjects = projectGroup.getProjects();
+            if ( isAuthorizedViewProjectGroup( getProjectGroupName() ) )
+            {
+                groupProjects = projectGroup.getProjects();
 
-        populateProjectGroupUsers( projectGroup );
+                populateProjectGroupUsers( projectGroup );
+            }
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }
 
         return SUCCESS;
     }
@@ -149,14 +181,29 @@
     public String remove()
         throws ContinuumException
     {
-        if ( confirmed )
+        try
+        {
+            if ( isAuthorizedRemoveProjectGroup( getProjectGroupName() ) )
+            {
+                if ( confirmed )
+                {
+                    getContinuum().removeProjectGroup( projectGroupId );
+                }
+                else
+                {
+                    name = getProjectGroupName();
+                    return CONFIRM;
+                }
+            }
+        }
+        catch ( AuthorizationRequiredException authzE )
         {
-            getContinuum().removeProjectGroup( projectGroupId );
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
         }
-        else
+        catch ( AuthenticationRequiredException authnE )
         {
-            name = getContinuum().getProjectGroup( projectGroupId ).getName();
-            return CONFIRM;
+            return REQUIRES_AUTHENTICATION;
         }
 
         return SUCCESS;
@@ -167,32 +214,47 @@
     {
         projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId );
 
-        name = projectGroup.getName();
+        try
+        {
+            if ( isAuthorizedModifyProjectGroup( getProjectGroupName() ) )
+            {
+                name = projectGroup.getName();
+
+                description = projectGroup.getDescription();
 
-        description = projectGroup.getDescription();
+                projectList = projectGroup.getProjects();
 
-        projectList = projectGroup.getProjects();
+                if ( projectList != null )
+                {
+                    Iterator proj = projectList.iterator();
 
-        if ( projectList != null )
-        {
-            Iterator proj = projectList.iterator();
+                    while ( proj.hasNext() )
+                    {
+                        Project p = (Project) proj.next();
+                        if ( getContinuum().isInCheckoutQueue( p.getId() ) )
+                        {
+                            projectInCOQueue = true;
+                        }
+                        projects.put( p, new Integer( p.getProjectGroup().getId() ) );
+                    }
+                }
 
-            while ( proj.hasNext() )
-            {
-                Project p = (Project) proj.next();
-                if ( getContinuum().isInCheckoutQueue( p.getId() ) )
+                Iterator proj_group = getContinuum().getAllProjectGroupsWithProjects().iterator();
+                while ( proj_group.hasNext() )
                 {
-                    projectInCOQueue = true;
+                    ProjectGroup pg = (ProjectGroup) proj_group.next();
+                    projectGroups.put( new Integer( pg.getId() ), pg.getName() );
                 }
-                projects.put( p, new Integer( p.getProjectGroup().getId() ) );
             }
         }
-
-        Iterator proj_group = getContinuum().getAllProjectGroupsWithProjects().iterator();
-        while ( proj_group.hasNext() )
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
         {
-            ProjectGroup pg = (ProjectGroup) proj_group.next();
-            projectGroups.put( new Integer( pg.getId() ), pg.getName() );
+            return REQUIRES_AUTHENTICATION;
         }
 
         return SUCCESS;
@@ -203,58 +265,73 @@
     {
         projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId );
 
-        // need to administer roles since they are based off of this
-        // todo convert everything like to work off of string keys
-        if ( !name.equals( projectGroup.getName() ) )
+        try
         {
-            try
+            if ( isAuthorizedModifyProjectGroup( getProjectGroupName() ) )
             {
-                roleManager.renameDynamicRole( "continuum-group-developer", projectGroup.getName(), name );
-                roleManager.renameDynamicRole( "continuum-group-user", projectGroup.getName(), name );
+                // need to administer roles since they are based off of this
+                // todo convert everything like to work off of string keys
+                if ( !name.equals( projectGroup.getName() ) )
+                {
+                    try
+                    {
+                        roleManager.renameDynamicRole( "continuum-group-developer", projectGroup.getName(), name );
+                        roleManager.renameDynamicRole( "continuum-group-user", projectGroup.getName(), name );
 
-                projectGroup.setName( name );
-            }
-            catch ( RoleProfileException e )
-            {
-                throw new ContinuumException( "unable to rename the project group", e );
-            }
+                        projectGroup.setName( name );
+                    }
+                    catch ( RoleProfileException e )
+                    {
+                        throw new ContinuumException( "unable to rename the project group", e );
+                    }
 
-        }
+                }
 
-        projectGroup.setDescription( description );
+                projectGroup.setDescription( description );
 
-        getContinuum().updateProjectGroup( projectGroup );
+                getContinuum().updateProjectGroup( projectGroup );
 
-        Iterator keys = projects.keySet().iterator();
-        while ( keys.hasNext() )
-        {
-            String key = (String) keys.next();
+                Iterator keys = projects.keySet().iterator();
+                while ( keys.hasNext() )
+                {
+                    String key = (String) keys.next();
 
-            String[] id = (String[]) projects.get( key );
+                    String[] id = (String[]) projects.get( key );
 
-            int projectId = Integer.parseInt( key );
+                    int projectId = Integer.parseInt( key );
 
-            Project project = null;
-            Iterator i = projectGroup.getProjects().iterator();
-            while ( i.hasNext() )
-            {
-                project = (Project) i.next();
-                if ( projectId == project.getId() )
-                {
-                    break;
-                }
-            }
+                    Project project = null;
+                    Iterator i = projectGroup.getProjects().iterator();
+                    while ( i.hasNext() )
+                    {
+                        project = (Project) i.next();
+                        if ( projectId == project.getId() )
+                        {
+                            break;
+                        }
+                    }
 
-            ProjectGroup newProjectGroup = getContinuum().getProjectGroup( new Integer( id[0] ).intValue() );
+                    ProjectGroup newProjectGroup = getContinuum().getProjectGroup( new Integer( id[0] ).intValue() );
 
-            if ( newProjectGroup.getId() != projectGroup.getId() )
-            {
-                getLogger().info(
-                    "Moving project " + project.getName() + " to project group " + newProjectGroup.getName() );
-                project.setProjectGroup( newProjectGroup );
-                getContinuum().updateProject( project );
+                    if ( newProjectGroup.getId() != projectGroup.getId() )
+                    {
+                        getLogger().info(
+                            "Moving project " + project.getName() + " to project group " + newProjectGroup.getName() );
+                        project.setProjectGroup( newProjectGroup );
+                        getContinuum().updateProject( project );
+                    }
+                }
             }
         }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }
 
         return SUCCESS;
     }
@@ -262,7 +339,22 @@
     public String build()
         throws ContinuumException
     {
-        getContinuum().buildProjectGroup( projectGroupId );
+        try
+        {
+            if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) )
+            {
+                getContinuum().buildProjectGroup( projectGroupId );
+            }
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }
 
         return SUCCESS;
     }
@@ -273,53 +365,70 @@
         //get the parent of the group by finding the parent project
         //i.e., the project that doesn't have a parent, or it's parent is not in the group.
 
-        Project parent = null;
+        try
+        {
+            if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) )
+            {
+                Project parent = null;
 
-        boolean allBuildsOk = true;
+                boolean allBuildsOk = true;
 
-        projectList = getContinuum().getProjectsInGroupWithDependencies( projectGroupId );
+                projectList = getContinuum().getProjectsInGroupWithDependencies( projectGroupId );
 
-        if ( projectList != null )
-        {
-            Iterator proj = projectList.iterator();
+                if ( projectList != null )
+                {
+                    Iterator proj = projectList.iterator();
 
-            while ( proj.hasNext() )
-            {
-                Project p = (Project) proj.next();
+                    while ( proj.hasNext() )
+                    {
+                        Project p = (Project) proj.next();
 
-                if ( p.getState() != ContinuumProjectState.OK )
-                {
-                    allBuildsOk = false;
+                        if ( p.getState() != ContinuumProjectState.OK )
+                        {
+                            allBuildsOk = false;
+                        }
+
+                        if ( ( p.getParent() == null ) || ( !isParentInProjectGroup( p.getParent(), projectList ) ) )
+                        {
+                            if ( parent == null )
+                            {
+                                parent = p;
+                            }
+                            else
+                            {
+                                //currently, we have no provisions for releasing 2 or more parents
+                                //at the same time, this will be implemented in the future
+                                throw new ContinuumException(
+                                    "Cannot release two or more parent projects in the same project group at the same time." );
+                            }
+                        }
+                    }
                 }
 
-                if ( ( p.getParent() == null ) || ( !isParentInProjectGroup( p.getParent(), projectList ) ) )
+                releaseProjectId = parent.getId();
+
+                if ( allBuildsOk )
                 {
-                    if ( parent == null )
-                    {
-                        parent = p;
-                    }
-                    else
-                    {
-                        //currently, we have no provisions for releasing 2 or more parents
-                        //at the same time, this will be implemented in the future
-                        throw new ContinuumException(
-                            "Cannot release two or more parent projects in the same project group at the same time." );
-                    }
+                    return SUCCESS;
+                }
+                else
+                {
+                    throw new ContinuumException(
+                        "Cannot release project group: one or more projects in the group were not built successfully." );
                 }
             }
         }
-
-        releaseProjectId = parent.getId();
-
-        if ( allBuildsOk )
+        catch ( AuthorizationRequiredException authzE )
         {
-            return SUCCESS;
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
         }
-        else
+        catch ( AuthenticationRequiredException authnE )
         {
-            throw new ContinuumException(
-                "Cannot release project group: one or more projects in the group were not built successfully." );
+            return REQUIRES_AUTHENTICATION;
         }
+
+        return SUCCESS;
     }
 
     private boolean isParentInProjectGroup( ProjectDependency parent, Collection projectsInGroup )
@@ -555,6 +664,31 @@
     public int getReleaseProjectId()
     {
         return this.releaseProjectId;
+    }
+
+    public ProjectGroup getProjectGroup( int projectGroupId )
+        throws ContinuumException
+    {
+        if ( projectGroup == null )
+        {
+            projectGroup = getContinuum().getProjectGroup( projectGroupId );
+        }
+        else
+        {
+            if ( projectGroup.getId() != projectGroupId )
+            {
+                projectGroup = getContinuum().getProjectGroup( projectGroupId );   
+            }
+        }
+
+        return projectGroup;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+
+        return getProjectGroup( projectGroupId ).getName();
     }
 
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectViewAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectViewAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectViewAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectViewAction.java Mon Feb 19 18:41:37 2007
@@ -20,8 +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.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;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -33,6 +37,7 @@
  */
 public class ProjectViewAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
 
     private Project project;
@@ -47,9 +52,9 @@
     public String execute()
         throws ContinuumException
     {
-        projectGroup = getContinuum().getProjectGroupByProjectId( projectId );
-        project = getContinuum().getProjectWithAllDetails( projectId );
+        projectGroup = getProjectGroup();
 
+        project = getContinuum().getProjectWithAllDetails( projectId );
         return SUCCESS;
     }
 
@@ -75,7 +80,29 @@
      * @return the projectGroup
      */
     public ProjectGroup getProjectGroup()
+            throws ContinuumException
     {
-        return projectGroup;
+        return getContinuum().getProjectGroupByProjectId( projectId );
     }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+        
+        try
+        {
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION,
+                getProjectGroup().getName() );
+        }
+        catch ( ContinuumException ce )
+        {
+
+        }
+
+        return bundle;
+    }
+
+
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseCleanupAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseCleanupAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseCleanupAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseCleanupAction.java Mon Feb 19 18:41:37 2007
@@ -21,6 +21,11 @@
 
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.release.ContinuumReleaseManagerListener;
+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;
 
 /**
  * @author Edwin Punzalan
@@ -31,21 +36,23 @@
  */
 public class ReleaseCleanupAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     private int projectId;
 
     private String releaseId;
 
+    private String projectGroupName = "";
+
     public String execute()
         throws Exception
-    {
+    {                 
+
         ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
 
         releaseManager.getReleaseResults().remove( releaseId );
 
-        ContinuumReleaseManagerListener listener;
-
-        listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().remove( releaseId );
+        ContinuumReleaseManagerListener listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().remove( releaseId );
 
         if ( listener != null )
         {
@@ -57,6 +64,7 @@
         {
             throw new Exception( "No listener to cleanup for id " + releaseId );
         }
+
     }
 
     public String getReleaseId()
@@ -77,5 +85,35 @@
     public void setProjectId( int projectId )
     {
         this.projectId = projectId;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+        }
+
+        return projectGroupName;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+
+        try
+        {
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_BUILD_PROJECT_IN_GROUP_OPERATION,
+                getProjectGroupName() );
+        }
+        catch ( ContinuumException ce )
+        {
+
+        }
+
+        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java Mon Feb 19 18:41:37 2007
@@ -21,7 +21,12 @@
 
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.release.ContinuumReleaseManagerListener;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.shared.release.ReleaseResult;
+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;
 
 /**
  * @author Edwin Punzalan
@@ -32,6 +37,7 @@
  */
 public class ReleaseInProgressAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     private int projectId;
 
@@ -43,10 +49,12 @@
 
     private ReleaseResult result;
 
+    private String projectGroupName = "";
+
     public String execute()
         throws Exception
     {
-        String status;
+        String status = "";
 
         ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
 
@@ -78,6 +86,7 @@
     public String viewResult()
         throws Exception
     {
+
         ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
 
         listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().get( releaseId );
@@ -149,5 +158,35 @@
     public void setReleaseGoal( String releaseGoal )
     {
         this.releaseGoal = releaseGoal;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+        }
+
+        return projectGroupName;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+
+        try
+        {
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_BUILD_PROJECT_IN_GROUP_OPERATION,
+                getProjectGroupName() );
+        }
+        catch ( ContinuumException ce )
+        {
+
+        }
+
+        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java Mon Feb 19 18:41:37 2007
@@ -23,10 +23,14 @@
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.release.ContinuumReleaseManagerListener;
 import org.apache.maven.continuum.release.DefaultReleaseManagerListener;
-
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+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 java.io.File;
 
@@ -39,6 +43,7 @@
  */
 public class ReleasePerformAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     private int projectId;
 
@@ -62,9 +67,12 @@
 
     private ReleaseResult result;
 
+    private String projectGroupName = "";
+
     public String inputFromScm()
         throws Exception
     {
+
         populateFromProject();
 
         releaseId = "";
@@ -75,12 +83,15 @@
     public String input()
         throws Exception
     {
+
         return SUCCESS;
+
     }
 
     public String execute()
         throws Exception
     {
+
         listener = new DefaultReleaseManagerListener();
 
         ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
@@ -245,5 +256,35 @@
     public void setProjectId( int projectId )
     {
         this.projectId = projectId;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+        }
+
+        return projectGroupName;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+
+        try
+        {
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_BUILD_PROJECT_IN_GROUP_OPERATION,
+                getProjectGroupName() );
+        }
+        catch ( ContinuumException ce )
+        {
+
+        }
+
+        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java Mon Feb 19 18:41:37 2007
@@ -23,6 +23,9 @@
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.release.ContinuumReleaseManagerListener;
 import org.apache.maven.continuum.release.DefaultReleaseManagerListener;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.security.ContinuumRoleConstants;
+
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
@@ -32,6 +35,9 @@
 import org.apache.maven.shared.release.versions.DefaultVersionInfo;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
+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 java.io.File;
 import java.io.FileReader;
@@ -51,6 +57,7 @@
  */
 public class ReleasePrepareAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     private static final String SCM_SVN_PROTOCOL_PREFIX = "scm:svn";
 
@@ -82,31 +89,48 @@
 
     private ContinuumReleaseManagerListener listener;
 
+    private String projectGroupName = "";
+
     public String input()
         throws Exception
     {
-        Project project = getContinuum().getProject( projectId );
-        scmUsername = project.getScmUsername();
-        scmPassword = project.getScmPassword();
-        scmTag = project.getScmTag();
-
-        String scmUrl = project.getScmUrl();
-        if ( scmUrl.startsWith( SCM_SVN_PROTOCOL_PREFIX ) )
-        {
-            scmTagBase = new SvnScmProviderRepository( scmUrl, scmUsername, scmPassword ).getTagBase();
-            // strip the Maven scm protocol prefix
-            scmTagBase = scmTagBase.substring( SCM_SVN_PROTOCOL_PREFIX.length() + 1 );
-        }
-        else
+       /* try
         {
-            scmTagBase = "";
-        }
+            if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) )
+            { */
+                Project project = getContinuum().getProject( projectId );
+                scmUsername = project.getScmUsername();
+                scmPassword = project.getScmPassword();
+                scmTag = project.getScmTag();
 
-        prepareGoals = "clean integration-test";
+                String scmUrl = project.getScmUrl();
+                if ( scmUrl.startsWith( SCM_SVN_PROTOCOL_PREFIX ) )
+                {
+                    scmTagBase = new SvnScmProviderRepository( scmUrl, scmUsername, scmPassword ).getTagBase();
+                    // strip the Maven scm protocol prefix
+                    scmTagBase = scmTagBase.substring( SCM_SVN_PROTOCOL_PREFIX.length() + 1 );
+                }
+                else
+                {
+                    scmTagBase = "";
+                }
 
-        getReleasePluginParameters( project.getWorkingDirectory(), "pom.xml" );
+                prepareGoals = "clean integration-test";
 
-        processProject( project.getWorkingDirectory(), "pom.xml" );
+                getReleasePluginParameters( project.getWorkingDirectory(), "pom.xml" );
+
+                processProject( project.getWorkingDirectory(), "pom.xml" );
+        /*    }
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }     */
 
         return SUCCESS;
     }
@@ -159,20 +183,35 @@
     public String execute()
         throws Exception
     {
-        listener = new DefaultReleaseManagerListener();
+       /* try
+        {
+            if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) )
+            {       */
+                listener = new DefaultReleaseManagerListener();
 
-        Project project = getContinuum().getProject( projectId );
+                Project project = getContinuum().getProject( projectId );
 
-        name = project.getName();
-        if ( name == null )
-        {
-            name = project.getArtifactId();
-        }
+                name = project.getName();
+                if ( name == null )
+                {
+                    name = project.getArtifactId();
+                }
 
-        ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
+                ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
 
-        releaseId = releaseManager.prepare( project, getReleaseProperties(), getRelVersionMap(),
-                                            getDevVersionMap(), listener );
+                releaseId = releaseManager.prepare( project, getReleaseProperties(), getRelVersionMap(),
+                                                    getDevVersionMap(), listener );
+     /*       }
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }       */
 
         return SUCCESS;
     }
@@ -455,5 +494,34 @@
     public void validate()
     {
 
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+        }
+
+        return projectGroupName;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+        try
+        {
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_BUILD_GROUP_OPERATION,
+                getProjectGroupName() );
+        }
+        catch ( ContinuumException e )
+        {
+            
+        }
+
+        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java Mon Feb 19 18:41:37 2007
@@ -22,7 +22,12 @@
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+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 java.util.List;
 import java.util.Map;
@@ -36,6 +41,7 @@
  */
 public class ReleaseProjectAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     private int projectId;
 
@@ -53,9 +59,12 @@
 
     private List releaseList;
 
+    private String projectGroupName = "";
+
     public String promptReleaseGoal()
         throws Exception
     {
+
         project = getContinuum().getProjectWithAllDetails( projectId );
 
         String releaseId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
@@ -80,6 +89,7 @@
     public String execute()
         throws Exception
     {
+
         if ( "prepare".equals( goal ) )
         {
             return "prepareRelease";
@@ -179,5 +189,35 @@
     public void setProjectName( String projectName )
     {
         this.projectName = projectName;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+        }
+
+        return projectGroupName;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+
+        try
+        {
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_BUILD_PROJECT_IN_GROUP_OPERATION,
+                getProjectGroupName() );
+        }
+        catch ( ContinuumException ce )
+        {
+
+        }
+
+        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectGoalAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectGoalAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectGoalAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectGoalAction.java Mon Feb 19 18:41:37 2007
@@ -22,7 +22,12 @@
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+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 java.util.Map;
 
@@ -35,6 +40,7 @@
  */
 public class ReleaseProjectGoalAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     private int projectId;
 
@@ -46,6 +52,8 @@
 
     private String preparedReleaseId;
 
+    private String projectGroupName = "";
+
     public String execute()
         throws Exception
     {
@@ -67,6 +75,7 @@
 
         projectName = project.getName();
 
+
         return SUCCESS;
     }
 
@@ -118,5 +127,35 @@
     public void setPreparedReleaseId( String preparedReleaseId )
     {
         this.preparedReleaseId = preparedReleaseId;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+        }
+
+        return projectGroupName;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+
+        try
+        {
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_BUILD_PROJECT_IN_GROUP_OPERATION,
+                getProjectGroupName() );
+        }
+        catch ( ContinuumException ce )
+        {
+
+        }
+
+        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java Mon Feb 19 18:41:37 2007
@@ -23,6 +23,11 @@
 import org.apache.maven.continuum.release.ContinuumReleaseManagerListener;
 import org.apache.maven.continuum.release.DefaultReleaseManagerListener;
 import org.apache.maven.continuum.model.project.Project;
+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;
 
 /**
  * @author Edwin Punzalan
@@ -33,36 +38,54 @@
  */
 public class ReleaseRollbackAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     private int projectId;
 
     private String releaseId;
 
+    private String projectGroupName = "";
+
     public String execute()
         throws Exception
     {
-        ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
-
-        ContinuumReleaseManagerListener listener = new DefaultReleaseManagerListener();
-
-        Project project = getContinuum().getProject( projectId );
-
-        releaseManager.rollback( releaseId, project.getWorkingDirectory(), listener );
+        /*try
+        {
+            if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) )
+            { */
+                ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
+
+                ContinuumReleaseManagerListener listener = new DefaultReleaseManagerListener();
+
+                Project project = getContinuum().getProject( projectId );
+
+                releaseManager.rollback( releaseId, project.getWorkingDirectory(), listener );
+
+                //recurse until rollback is finished
+                while( listener.getState() != ContinuumReleaseManagerListener.FINISHED )
+                {
+                    try
+                    {
+                        Thread.sleep( 1000 );
+                    }
+                    catch( InterruptedException e )
+                    {
+                        //do nothing
+                    }
+                }
 
-        //recurse until rollback is finished
-        while( listener.getState() != ContinuumReleaseManagerListener.FINISHED )
+                releaseManager.getPreparedReleases().remove( releaseId );
+        /*    }
+        }
+        catch ( AuthorizationRequiredException authzE )
         {
-            try
-            {
-                Thread.sleep( 1000 );
-            }
-            catch( InterruptedException e )
-            {
-                //do nothing
-            }
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
         }
-
-        releaseManager.getPreparedReleases().remove( releaseId );
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        } */
 
         return SUCCESS;
     }
@@ -70,6 +93,23 @@
     public String warn()
         throws Exception
     {
+        /*try
+        {
+            if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) )
+            {
+                return SUCCESS;
+            }
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        } */
+        
         return SUCCESS;
     }
 
@@ -92,4 +132,34 @@
     {
         this.releaseId = releaseId;
     }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+        }
+
+        return projectGroupName;
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+
+        try
+        {
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_BUILD_PROJECT_IN_GROUP_OPERATION,
+                getProjectGroupName() );
+        }
+        catch ( ContinuumException ce )
+        {
+
+        }
+
+        return bundle;
+    }
+
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java Mon Feb 19 18:41:37 2007
@@ -20,9 +20,13 @@
  */
 
 import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.web.model.ProjectSummary;
+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 java.util.ArrayList;
 import java.util.Collection;
@@ -40,6 +44,7 @@
  */
 public class SummaryAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     private int projectGroupId;
 
@@ -146,4 +151,16 @@
     {
         this.projectGroupName = projectGroupName;
     }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+        bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION,
+            getProjectGroupName() );
+
+        return bundle;
+    }
+
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java Mon Feb 19 18:41:37 2007
@@ -20,9 +20,15 @@
  */
 
 import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.security.ContinuumRoleConstants;
+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.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.StringUtils;
+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.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
@@ -53,6 +59,7 @@
  */
 public class SurefireReportAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     private int buildId;
 
@@ -71,7 +78,7 @@
     public String execute()
         throws ContinuumException
     {
-        project = getContinuum().getProject( projectId );
+        project = getProjectById( projectId );
 
         //@todo maven-surefire-report reportsDirectory should be detected ?
         File reportsDirectory = new File( project.getWorkingDirectory() + "/target/surefire-reports" );
@@ -742,5 +749,35 @@
         {
             this.failureDetails = failureDetails;
         }
+    }
+
+    public Project getProjectById( int projectId )
+            throws ContinuumException
+    {
+        return getContinuum().getProject( projectId );
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        return getProjectById( projectId ).getProjectGroup().getName();
+    }
+
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
+
+        try
+        {
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION,
+                getProjectGroupName() );
+        }
+        catch ( ContinuumException ce )
+        {
+
+        }
+
+        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/WorkingCopyAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/WorkingCopyAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/WorkingCopyAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/WorkingCopyAction.java Mon Feb 19 18:41:37 2007
@@ -21,18 +21,13 @@
 
 import com.opensymphony.webwork.ServletActionContext;
 import com.opensymphony.webwork.views.util.UrlHelper;
-import com.opensymphony.xwork.ActionContext;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.continuum.web.util.WorkingCopyContentGenerator;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.security.authorization.AuthorizationException;
-import org.codehaus.plexus.security.system.SecuritySession;
-import org.codehaus.plexus.security.system.SecuritySystem;
-import org.codehaus.plexus.security.system.SecuritySystemConstants;
-import org.codehaus.plexus.xwork.PlexusLifecycleListener;
+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 javax.activation.MimetypesFileTypeMap;
 import java.io.File;
@@ -49,6 +44,7 @@
  */
 public class WorkingCopyAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     /**
      * @plexus.requirement
@@ -77,62 +73,62 @@
 
     private static String FILE_SEPARATOR = System.getProperty( "file.separator" );
 
+    private String projectGroupName = "";
+
     public String execute()
         throws ContinuumException
     {
+
         files = getContinuum().getFiles( projectId, userDirectory );
 
         project = getContinuum().getProject( projectId );
 
         projectName = project.getName();
 
-        if ( isAuthorized( project ) )
-        {
-            HashMap params = new HashMap();
+        HashMap params = new HashMap();
 
-            params.put( "projectId", new Integer( projectId ) );
+        params.put( "projectId", new Integer( projectId ) );
 
-            params.put( "projectName", projectName );
+        params.put( "projectName", projectName );
 
-            String baseUrl = UrlHelper.buildUrl( "/workingCopy.action", ServletActionContext.getRequest(),
-                                                 ServletActionContext.getResponse(), params );
+        String baseUrl = UrlHelper.buildUrl( "/workingCopy.action", ServletActionContext.getRequest(),
+                                             ServletActionContext.getResponse(), params );
 
-            output = generator.generate( files, baseUrl, getContinuum().getWorkingDirectory( projectId ) );
+        output = generator.generate( files, baseUrl, getContinuum().getWorkingDirectory( projectId ) );
 
-            if ( currentFile != null && currentFile != "" )
-            {
-                String dir;
+        if ( currentFile != null && currentFile != "" )
+        {
+            String dir;
 
-                //TODO: maybe create a plexus component for this so that additional mimetypes can be easily added
-                MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
-                mimeTypesMap.addMimeTypes( "application/java-archive jar war ear" );
-                mimeTypesMap.addMimeTypes( "application/java-class class" );
-                mimeTypesMap.addMimeTypes( "image/png png" );
-
-                if ( FILE_SEPARATOR.equals( userDirectory ) )
-                {
-                    dir = userDirectory;
-                }
-                else
-                {
-                    dir = FILE_SEPARATOR + userDirectory + FILE_SEPARATOR;
-                }
-
-                downloadFile = new File( getContinuum().getWorkingDirectory( projectId ) + dir + currentFile );
-                mimeType = mimeTypesMap.getContentType( downloadFile );
-
-                if ( ( mimeType.indexOf( "image" ) >= 0 ) || ( mimeType.indexOf( "java-archive" ) >= 0 ) ||
-                    ( mimeType.indexOf( "java-class" ) >= 0 ) || ( downloadFile.length() > 100000 ) )
-                {
-                    return "stream";
-                }
+            //TODO: maybe create a plexus component for this so that additional mimetypes can be easily added
+            MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
+            mimeTypesMap.addMimeTypes( "application/java-archive jar war ear" );
+            mimeTypesMap.addMimeTypes( "application/java-class class" );
+            mimeTypesMap.addMimeTypes( "image/png png" );
 
-                currentFileContent = getContinuum().getFileContent( projectId, userDirectory, currentFile );
+            if ( FILE_SEPARATOR.equals( userDirectory ) )
+            {
+                dir = userDirectory;
             }
             else
             {
-                currentFileContent = "";
+                dir = FILE_SEPARATOR + userDirectory + FILE_SEPARATOR;
             }
+
+            downloadFile = new File( getContinuum().getWorkingDirectory( projectId ) + dir + currentFile );
+            mimeType = mimeTypesMap.getContentType( downloadFile );
+
+            if ( ( mimeType.indexOf( "image" ) >= 0 ) || ( mimeType.indexOf( "java-archive" ) >= 0 ) ||
+                ( mimeType.indexOf( "java-class" ) >= 0 ) || ( downloadFile.length() > 100000 ) )
+            {
+                return "stream";
+            }
+
+            currentFileContent = getContinuum().getFileContent( projectId, userDirectory, currentFile );
+        }
+        else
+        {
+            currentFileContent = "";
         }
 
         return SUCCESS;
@@ -220,34 +216,32 @@
         return project;
     }
 
-    private boolean isAuthorized( Project project )
+    public String getProjectGroupName()
+        throws ContinuumException
     {
-        // do the authz bit
-        ActionContext context = ActionContext.getContext();
+        if( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+        }
 
-        PlexusContainer container = (PlexusContainer) context.getApplication().get( PlexusLifecycleListener.KEY );
-        SecuritySession securitySession =
-            (SecuritySession) context.getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );
+        return projectGroupName;
+    }
 
-        try
-        {
-            SecuritySystem securitySystem = (SecuritySystem) container.lookup( SecuritySystem.ROLE );
+    public SecureActionBundle getSecureActionBundle()
+        throws SecureActionException {
+        SecureActionBundle bundle = new SecureActionBundle();
+        bundle.setRequiresAuthentication( true );
 
-            if ( !securitySystem.isAuthorized( securitySession, ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION,
-                                               project.getProjectGroup().getName() ) )
-            {
-                return false;
-            }
-        }
-        catch ( ComponentLookupException cle )
+        try
         {
-            return false;
+            bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION,
+                getProjectGroupName() );
         }
-        catch ( AuthorizationException ae )
+        catch ( ContinuumException ce )
         {
-            return false;
+
         }
 
-        return true;
+        return bundle;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java Mon Feb 19 18:41:37 2007
@@ -25,6 +25,8 @@
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
 import org.apache.maven.continuum.web.model.BuildDefinitionSummary;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -61,17 +63,30 @@
             projectGroup = getContinuum().getProjectGroupByProjectId( projectId );
             projectGroupId = projectGroup.getId();
             projectGroupName = projectGroup.getName();
-            groupBuildDefinitionSummaries = gatherGroupBuildDefinitionSummaries( projectGroupId );
-            projectBuildDefinitionSummaries = gatherProjectBuildDefinitionSummaries( projectId );
 
-            allBuildDefinitionSummaries.addAll( groupBuildDefinitionSummaries );
-            allBuildDefinitionSummaries.addAll( projectBuildDefinitionSummaries );
+            if ( isAuthorizedViewProjectGroup( projectGroupName ) )
+            {
+                groupBuildDefinitionSummaries = gatherGroupBuildDefinitionSummaries( projectGroupId );
+                projectBuildDefinitionSummaries = gatherProjectBuildDefinitionSummaries( projectId );
+
+                allBuildDefinitionSummaries.addAll( groupBuildDefinitionSummaries );
+                allBuildDefinitionSummaries.addAll( projectBuildDefinitionSummaries );
+            }
         }
         catch ( ContinuumException e )
         {
             getLogger().info( "unable to build summary" );
             return ERROR;
         }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }
 
         return SUCCESS;
     }
@@ -84,20 +99,32 @@
 
             projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId );
 
-            for ( Iterator i = projectGroup.getProjects().iterator(); i.hasNext(); )
+            if ( isAuthorizedViewProjectGroup(  projectGroup.getName() ) )
             {
-                Project project = (Project) i.next();
-                projectBuildDefinitionSummaries.addAll( gatherProjectBuildDefinitionSummaries( project.getId() ) );
+                for ( Iterator i = projectGroup.getProjects().iterator(); i.hasNext(); )
+                {
+                    Project project = (Project) i.next();
+                    projectBuildDefinitionSummaries.addAll( gatherProjectBuildDefinitionSummaries( project.getId() ) );
 
-            }
+                }
 
-            allBuildDefinitionSummaries.addAll( groupBuildDefinitionSummaries );
-            allBuildDefinitionSummaries.addAll( projectBuildDefinitionSummaries );
+                allBuildDefinitionSummaries.addAll( groupBuildDefinitionSummaries );
+                allBuildDefinitionSummaries.addAll( projectBuildDefinitionSummaries );
+            }
         }
         catch ( ContinuumException e )
         {
             getLogger().info( "unable to build summary" );
             return ERROR;
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
         }
 
         return SUCCESS;

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/NotifierSummaryAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/NotifierSummaryAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/NotifierSummaryAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/NotifierSummaryAction.java Mon Feb 19 18:41:37 2007
@@ -28,6 +28,8 @@
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
 import org.apache.maven.continuum.web.model.NotifierSummary;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -67,6 +69,8 @@
 
     private List projectNotifierSummaries = new ArrayList();
 
+    private String projectGroupName = "";
+
     /**
      * Prepare Notifier summary for a {@link Project}.
      *
@@ -78,13 +82,25 @@
 
         try
         {
-            projectNotifierSummaries = summarizeForProject( projectId );
+            if ( isAuthorizedViewProjectGroup( getProjectGroupName() ) )
+            {
+                projectNotifierSummaries = summarizeForProject( projectId );
+            }
         }
         catch ( ContinuumException e )
         {
             getLogger().error( "Unable to prepare Notifier summaries for Project Id: " + projectId, e );
             return ERROR;
         }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }
 
         return SUCCESS;
     }
@@ -112,15 +128,18 @@
 
         try
         {
-            projectGroupNotifierSummaries = gatherGroupNotifierSummaries();
-
-            Collection projects = getContinuum().getProjectsInGroup( projectGroupId );
-            if ( projects != null )
+            if ( isAuthorizedViewProjectGroup( getProjectGroupName() ) )
             {
-                for ( Iterator i = projects.iterator(); i.hasNext(); )
+                projectGroupNotifierSummaries = gatherGroupNotifierSummaries();
+
+                Collection projects = getContinuum().getProjectsInGroup( projectGroupId );
+                if ( projects != null )
                 {
-                    Project p = (Project) i.next();
-                    projectNotifierSummaries.addAll( summarizeForProject( p.getId() ) );
+                    for ( Iterator i = projects.iterator(); i.hasNext(); )
+                    {
+                        Project p = (Project) i.next();
+                        projectNotifierSummaries.addAll( summarizeForProject( p.getId() ) );
+                    }
                 }
             }
         }
@@ -129,6 +148,15 @@
             getLogger().error( "Unable to prepare Notifier summaries for ProjectGroup Id: " + projectGroupId, e );
             return ERROR;
         }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }
 
         return SUCCESS;
     }
@@ -372,5 +400,23 @@
     public void setProjectNotifierSummaries( List projectNotifierSummaries )
     {
         this.projectNotifierSummaries = projectNotifierSummaries;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            if ( projectGroupId != 0 )
+            {
+                projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
+            }
+            else
+            {
+                projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();                
+            }
+        }
+
+        return projectGroupName;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractGroupNotifierEditAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractGroupNotifierEditAction.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractGroupNotifierEditAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractGroupNotifierEditAction.java Mon Feb 19 18:41:37 2007
@@ -20,6 +20,8 @@
  */
 
 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.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 
@@ -38,6 +40,8 @@
      */
     private int projectGroupId;
 
+    private String projectGroupName = "";
+
     /**
      * Creates or updates the {@link ProjectNotifier} instance for the
      * {@link ProjectGroup} here.<p>
@@ -84,6 +88,30 @@
     public void setProjectGroupId( int projectGroupId )
     {
         this.projectGroupId = projectGroupId;
+    }
+
+    protected boolean isAuthorized()
+        throws AuthorizationRequiredException, AuthenticationRequiredException, ContinuumException
+    {
+        if( getNotifier() == null )
+        {
+            return isAuthorizedAddProjectGroupNotifier( getProjectGroupName() );
+        }
+        else
+        {
+            return isAuthorizedModifyProjectGroupNotifier( getProjectGroupName() );
+        }
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
+        }
+
+        return projectGroupName;
     }
 
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractNotifierEditActionSupport.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractNotifierEditActionSupport.java?view=diff&rev=509415&r1=509414&r2=509415
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractNotifierEditActionSupport.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractNotifierEditActionSupport.java Mon Feb 19 18:41:37 2007
@@ -22,6 +22,8 @@
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
 
 import java.util.Map;
 
@@ -109,30 +111,45 @@
     {
         ProjectNotifier notifier = getNotifier();
 
-        boolean isNew = ( notifier == null || getNotifierId() == 0 );
-
-        if ( isNew )
+        try
         {
-            notifier = new ProjectNotifier();
-        }
+            boolean isNew = ( notifier == null || getNotifierId() == 0 );
+
+            if ( isNew )
+            {
+                notifier = new ProjectNotifier();
+            }
 
-        notifier.setType( getNotifierType() );
+            if( isAuthorized() )
+            {
+                notifier.setType( getNotifierType() );
 
-        notifier.setSendOnSuccess( isSendOnSuccess() );
+                notifier.setSendOnSuccess( isSendOnSuccess() );
 
-        notifier.setSendOnFailure( isSendOnFailure() );
+                notifier.setSendOnFailure( isSendOnFailure() );
 
-        notifier.setSendOnError( isSendOnError() );
+                notifier.setSendOnError( isSendOnError() );
 
-        notifier.setSendOnWarning( isSendOnWarning() );
+                notifier.setSendOnWarning( isSendOnWarning() );
 
-        setNotifierConfiguration( notifier );
+                setNotifierConfiguration( notifier );
 
-        saveNotifier( notifier );
+                saveNotifier( notifier );
 
-        if ( fromGroupPage )
+                if ( fromGroupPage )
+                {
+                    return "to_group_page";
+                }
+            }
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
         {
-            return "to_group_page";
+            return REQUIRES_AUTHENTICATION;
         }
 
         return SUCCESS;
@@ -154,18 +171,33 @@
             notifier = new ProjectNotifier();
         }
 
-        // setup Action fields 
-        setNotifierType( notifier.getType() );
+        try
+        {
+            if ( isAuthorized() )
+            {
+                // setup Action fields
+                setNotifierType( notifier.getType() );
 
-        setSendOnSuccess( notifier.isSendOnSuccess() );
+                setSendOnSuccess( notifier.isSendOnSuccess() );
 
-        setSendOnFailure( notifier.isSendOnFailure() );
+                setSendOnFailure( notifier.isSendOnFailure() );
 
-        setSendOnError( notifier.isSendOnError() );
+                setSendOnError( notifier.isSendOnError() );
 
-        setSendOnWarning( notifier.isSendOnWarning() );
+                setSendOnWarning( notifier.isSendOnWarning() );
 
-        initConfiguration( notifier.getConfiguration() );
+                initConfiguration( notifier.getConfiguration() );
+            }
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException authnE )
+        {
+            return REQUIRES_AUTHENTICATION;
+        }
 
         return SUCCESS;
     }
@@ -295,4 +327,7 @@
      * @see #initConfiguration(Map)
      */
     protected abstract void setNotifierConfiguration( ProjectNotifier notifier );
+
+    protected abstract boolean isAuthorized() throws AuthorizationRequiredException,
+        AuthenticationRequiredException, ContinuumException;
 }

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=509415&r1=509414&r2=509415
==============================================================================
--- 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 Mon Feb 19 18:41:37 2007
@@ -20,6 +20,8 @@
  */
 
 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;
@@ -42,6 +44,8 @@
      */
     private int projectGroupId;
 
+    private String projectGroupName = "";
+
     /**
      * Save the notifier for the {@link Project} here.<p>
      * This is used by the subclasses that create/obtain an instance of
@@ -112,6 +116,37 @@
     public void setProjectGroupId( int projectGroupId )
     {
         this.projectGroupId = projectGroupId;
+    }
+
+    protected boolean isAuthorized()
+        throws AuthorizationRequiredException, AuthenticationRequiredException, ContinuumException
+    {
+        if( getNotifier() == null )
+        {
+            return isAuthorizedAddProjectNotifier( getProjectGroupName() );
+        }
+        else
+        {
+            return isAuthorizedModifyProjectNotifier( getProjectGroupName() );
+        }
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            if( projectGroupId != 0 )
+            {
+                projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
+            }
+            else
+            {
+                projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+            }
+        }
+
+        return projectGroupName;
     }
 
 }

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=509415&r1=509414&r2=509415
==============================================================================
--- 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 Mon Feb 19 18:41:37 2007
@@ -25,6 +25,11 @@
 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;
 
 /**
  * WW action that sets up a new {@link ProjectNotifier} instance for
@@ -37,6 +42,7 @@
  */
 public class AddGroupNotifierAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
 
     /**
@@ -49,6 +55,8 @@
      */
     private String notifierType;
 
+    private String projectGroupName = "";
+
     /**
      * Default action method executed in case no method is specified
      * for invocation.
@@ -56,13 +64,17 @@
      * @return a String result that determines the control flow.
      */
     public String execute()
+        throws ContinuumException
     {
+
         return notifierType + "_" + INPUT;
     }
 
     public String doDefault()
+        throws ContinuumException
     {
-        return INPUT;
+
+        return INPUT;           
     }
 
     /**
@@ -105,6 +117,35 @@
     public void setProjectGroupId( int projectGroupId )
     {
         this.projectGroupId = projectGroupId;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( 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=509415&r1=509414&r2=509415
==============================================================================
--- 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 Mon Feb 19 18:41:37 2007
@@ -23,6 +23,11 @@
 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;
 
 /**
  * Action to add a {@link ProjectNotifier} for a specified {@link Project}.
@@ -34,6 +39,7 @@
  */
 public class AddProjectNotifierAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
     /**
      * Identifier for the {@link Project} instance.
@@ -56,6 +62,8 @@
      */
     private boolean fromGroupPage = false;
 
+    private String projectGroupName = "";
+
     /**
      * Default method executed when no specific method is specified
      * for invocation.
@@ -63,6 +71,7 @@
      * @return result as a String value to determines the control flow.
      */
     public String execute()
+        throws ContinuumException
     {
         return notifierType + "_" + INPUT;
     }
@@ -71,6 +80,7 @@
      * TODO: document!
      */
     public String doDefault()
+        throws ContinuumException
     {
         return INPUT;
     }
@@ -152,5 +162,41 @@
     public void setFromGroupPage( boolean fromGroupPage )
     {
         this.fromGroupPage = fromGroupPage;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( projectGroupName ) )
+        {
+            if( projectGroupId != 0 )
+            {
+                projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
+            }
+            else
+            {
+                projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+            }
+        }
+
+        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=509415&r1=509414&r2=509415
==============================================================================
--- 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 Mon Feb 19 18:41:37 2007
@@ -20,9 +20,13 @@
  */
 
 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.codehaus.plexus.security.ui.web.interceptor.SecureAction;
 
 import java.util.Map;
 
@@ -37,6 +41,7 @@
  */
 public class DeleteGroupNotifierAction
     extends ContinuumActionSupport
+    implements SecureAction
 {
 
     private int projectGroupId;
@@ -47,16 +52,21 @@
 
     private String recipient;
 
+    private String projectGroupName = "";
+
     public String execute()
         throws ContinuumException
     {
+
         getContinuum().removeGroupNotifier( projectGroupId, notifierId );
+
         return SUCCESS;
     }
 
     public String doDefault()
         throws ContinuumException
     {
+
         ProjectNotifier notifier = getContinuum().getGroupNotifier( projectGroupId, notifierId );
 
         Map configuration = notifier.getConfiguration();
@@ -134,5 +144,34 @@
     public void setRecipient( String recipient )
     {
         this.recipient = recipient;
+    }
+
+    public String getProjectGroupName()
+            throws ContinuumException
+    {
+        if ( projectGroupName == null || "".equals( 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;
     }
 }



Mime
View raw message