Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java?view=diff&rev=510547&r1=510546&r2=510547 ============================================================================== --- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java (original) +++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java Thu Feb 22 07:24:47 2007 @@ -20,23 +20,16 @@ */ import org.apache.maven.continuum.ContinuumException; -import org.apache.maven.continuum.security.ContinuumRoleConstants; import org.apache.maven.continuum.model.project.Project; -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; /** * @author Emmanuel Venisse * @version $Id$ - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="deleteProject" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteProject" */ public class DeleteProjectAction extends ContinuumActionSupport - implements SecureAction { private int projectId; @@ -49,6 +42,15 @@ public String execute() throws ContinuumException { + try + { + checkRemoveProjectFromGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } + getContinuum().removeProject( projectId ); return SUCCESS; @@ -57,10 +59,18 @@ public String doDefault() throws ContinuumException { + try + { + checkRemoveProjectFromGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } Project project = getContinuum().getProject( projectId ); projectName = project.getName(); - + return "delete"; } @@ -111,23 +121,4 @@ return projectGroupName; } - - public SecureActionBundle getSecureActionBundle() - throws SecureActionException { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - - try - { - bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_FROM_GROUP_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/GroupSummaryAction.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java?view=diff&rev=510547&r1=510546&r2=510547 ============================================================================== --- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java (original) +++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java Thu Feb 22 07:24:47 2007 @@ -23,10 +23,9 @@ import org.apache.maven.continuum.model.project.BuildResult; import org.apache.maven.continuum.model.project.Project; import org.apache.maven.continuum.model.project.ProjectGroup; +import org.apache.maven.continuum.web.exception.AuthorizationRequiredException; import org.apache.maven.continuum.web.model.GroupSummary; import org.apache.maven.continuum.web.model.ProjectSummary; -import org.apache.maven.continuum.web.exception.AuthorizationRequiredException; -import org.apache.maven.continuum.web.exception.AuthenticationRequiredException; import java.util.ArrayList; import java.util.Collection; @@ -195,13 +194,10 @@ { try { - return isAuthorizedViewProjectGroup( projectGroupName ); + checkViewProjectGroupAuthorization( projectGroupName ); + return true; } catch ( AuthorizationRequiredException authzE ) - { - return false; - } - catch ( AuthenticationRequiredException authnE ) { return false; } Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java?view=diff&rev=510547&r1=510546&r2=510547 ============================================================================== --- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java (original) +++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java Thu Feb 22 07:24:47 2007 @@ -20,25 +20,17 @@ */ import org.apache.maven.continuum.ContinuumException; -import org.apache.maven.continuum.security.ContinuumRoleConstants; import org.apache.maven.continuum.model.project.Project; -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; /** * @author Emmanuel Venisse * @version $Id$ - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="projectEdit" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="projectEdit" */ public class ProjectEditAction extends ContinuumActionSupport - implements SecureAction { - private Project project; private int projectId; @@ -60,6 +52,15 @@ public String save() throws ContinuumException { + try + { + checkModifyProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } + project = getProject( projectId ); project.setName( name ); @@ -84,6 +85,15 @@ public String edit() throws ContinuumException { + try + { + checkModifyProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } + project = getProject( projectId ); name = project.getName(); @@ -199,24 +209,4 @@ { return getProject( projectId ).getProjectGroup().getName(); } - - public SecureActionBundle getSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - - try - { - bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_IN_GROUP_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/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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -26,7 +26,6 @@ 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; @@ -50,8 +49,7 @@ * * @author Jesse McConnell * @version $Id$ - * @plexus.component role="com.opensymphony.xwork.Action" - * role-hint="projectGroup" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="projectGroup" */ public class ProjectGroupAction extends ContinuumConfirmAction @@ -115,20 +113,15 @@ { try { - if( isAuthorizedViewProjectGroup( getProjectGroupName() ) ) - { - projectGroup = getProjectGroup( projectGroupId ); - } + checkViewProjectGroupAuthorization( getProjectGroupName() ); } catch ( AuthorizationRequiredException authzE ) { addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) - { - return REQUIRES_AUTHENTICATION; - } + + projectGroup = getProjectGroup( projectGroupId ); return SUCCESS; } @@ -138,24 +131,19 @@ { try { - projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId ); - - if ( isAuthorizedViewProjectGroup( getProjectGroupName() ) ) - { - groupProjects = projectGroup.getProjects(); - - populateProjectGroupUsers( projectGroup ); - } + checkViewProjectGroupAuthorization( getProjectGroupName() ); } catch ( AuthorizationRequiredException authzE ) { addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) - { - return REQUIRES_AUTHENTICATION; - } + + projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId ); + + groupProjects = projectGroup.getProjects(); + + populateProjectGroupUsers( projectGroup ); return SUCCESS; } @@ -183,27 +171,22 @@ { try { - if ( isAuthorizedRemoveProjectGroup( getProjectGroupName() ) ) - { - if ( confirmed ) - { - getContinuum().removeProjectGroup( projectGroupId ); - } - else - { - name = getProjectGroupName(); - return CONFIRM; - } - } + checkRemoveProjectGroupAuthorization( getProjectGroupName() ); } catch ( AuthorizationRequiredException authzE ) { addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) + + if ( confirmed ) + { + getContinuum().removeProjectGroup( projectGroupId ); + } + else { - return REQUIRES_AUTHENTICATION; + name = getProjectGroupName(); + return CONFIRM; } return SUCCESS; @@ -212,49 +195,44 @@ public String edit() throws ContinuumException { - projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId ); - try { - if ( isAuthorizedModifyProjectGroup( getProjectGroupName() ) ) - { - name = projectGroup.getName(); + checkModifyProjectGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException authzE ) + { + addActionError( authzE.getMessage() ); + return REQUIRES_AUTHORIZATION; + } - description = projectGroup.getDescription(); + projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId ); - projectList = projectGroup.getProjects(); + name = projectGroup.getName(); - if ( projectList != null ) - { - Iterator proj = projectList.iterator(); + description = projectGroup.getDescription(); - while ( proj.hasNext() ) - { - Project p = (Project) proj.next(); - if ( getContinuum().isInCheckoutQueue( p.getId() ) ) - { - projectInCOQueue = true; - } - projects.put( p, new Integer( p.getProjectGroup().getId() ) ); - } - } + projectList = projectGroup.getProjects(); + + if ( projectList != null ) + { + Iterator proj = projectList.iterator(); - Iterator proj_group = getContinuum().getAllProjectGroupsWithProjects().iterator(); - while ( proj_group.hasNext() ) + while ( proj.hasNext() ) + { + Project p = (Project) proj.next(); + if ( getContinuum().isInCheckoutQueue( p.getId() ) ) { - ProjectGroup pg = (ProjectGroup) proj_group.next(); - projectGroups.put( new Integer( pg.getId() ), pg.getName() ); + projectInCOQueue = true; } + projects.put( p, new Integer( p.getProjectGroup().getId() ) ); } } - catch ( AuthorizationRequiredException authzE ) - { - addActionError( authzE.getMessage() ); - return REQUIRES_AUTHORIZATION; - } - catch ( AuthenticationRequiredException authnE ) + + Iterator proj_group = getContinuum().getAllProjectGroupsWithProjects().iterator(); + while ( proj_group.hasNext() ) { - return REQUIRES_AUTHENTICATION; + ProjectGroup pg = (ProjectGroup) proj_group.next(); + projectGroups.put( new Integer( pg.getId() ), pg.getName() ); } return SUCCESS; @@ -263,75 +241,70 @@ public String save() throws ContinuumException { + try + { + checkModifyProjectGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException authzE ) + { + addActionError( authzE.getMessage() ); + return REQUIRES_AUTHORIZATION; + } + projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId ); - try + // 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() ) ) { - if ( isAuthorizedModifyProjectGroup( getProjectGroupName() ) ) + try { - // 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 ); + 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; } @@ -341,20 +314,15 @@ { try { - if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) ) - { - getContinuum().buildProjectGroup( projectGroupId ); - } + checkBuildProjectGroupAuthorization( getProjectGroupName() ); } catch ( AuthorizationRequiredException authzE ) { addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) - { - return REQUIRES_AUTHENTICATION; - } + + getContinuum().buildProjectGroup( projectGroupId ); return SUCCESS; } @@ -362,79 +330,72 @@ public String release() throws ContinuumException { - //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. - try { - if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) ) - { - Project parent = null; - - boolean allBuildsOk = true; + checkBuildProjectGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException authzE ) + { + addActionError( authzE.getMessage() ); + return REQUIRES_AUTHORIZATION; + } - projectList = getContinuum().getProjectsInGroupWithDependencies( projectGroupId ); + //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. - if ( projectList != null ) - { - Iterator proj = projectList.iterator(); + Project parent = null; - while ( proj.hasNext() ) - { - Project p = (Project) proj.next(); + boolean allBuildsOk = true; - 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 - addActionError( "projectGroup.release.error.severalParentProjects" ); - return INPUT; - } - } - } - } + projectList = getContinuum().getProjectsInGroupWithDependencies( projectGroupId ); - if ( parent == null ) - { - addActionError( "projectGroup.release.error.emptyGroup" ); - return INPUT; - } + if ( projectList != null ) + { + Iterator proj = projectList.iterator(); - releaseProjectId = parent.getId(); + while ( proj.hasNext() ) + { + Project p = (Project) proj.next(); - if ( allBuildsOk ) + if ( p.getState() != ContinuumProjectState.OK ) { - return SUCCESS; + allBuildsOk = false; } - else + + if ( ( p.getParent() == null ) || ( !isParentInProjectGroup( p.getParent(), projectList ) ) ) { - addActionError( "projectGroup.release.error.projectNotInSuccess" ); - return INPUT; + 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 + addActionError( "projectGroup.release.error.severalParentProjects" ); + return INPUT; + } } } } - catch ( AuthorizationRequiredException authzE ) + + if ( parent == null ) { - addActionError( authzE.getMessage() ); - return REQUIRES_AUTHORIZATION; + addActionError( "projectGroup.release.error.emptyGroup" ); + return INPUT; } - catch ( AuthenticationRequiredException authnE ) + + releaseProjectId = parent.getId(); + + if ( allBuildsOk ) { - return REQUIRES_AUTHENTICATION; + return SUCCESS; + } + else + { + addActionError( "projectGroup.release.error.projectNotInSuccess" ); + return INPUT; } - - return SUCCESS; } private boolean isParentInProjectGroup( ProjectDependency parent, Collection projectsInGroup ) @@ -683,7 +644,7 @@ { if ( projectGroup.getId() != projectGroupId ) { - projectGroup = getContinuum().getProjectGroup( projectGroupId ); + projectGroup = getContinuum().getProjectGroup( projectGroupId ); } } 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -20,24 +20,17 @@ */ 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; +import org.apache.maven.continuum.web.exception.AuthorizationRequiredException; /** * @author Emmanuel Venisse * @version $Id$ - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="projectView" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="projectView" */ public class ProjectViewAction extends ContinuumActionSupport - implements SecureAction { private Project project; @@ -52,6 +45,15 @@ public String execute() throws ContinuumException { + try + { + checkViewProjectGroupAuthorization( getProjectGroup().getName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } + projectGroup = getProjectGroup(); project = getContinuum().getProjectWithAllDetails( projectId ); @@ -74,35 +76,14 @@ } /** - * Returns the {@link ProjectGroup} instance obtained for + * Returns the {@link ProjectGroup} instance obtained for * the specified project group Id, or null if it were not set. - * + * * @return the projectGroup */ public ProjectGroup getProjectGroup() - throws ContinuumException + throws ContinuumException { 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -19,24 +19,17 @@ * under the License. */ +import org.apache.maven.continuum.ContinuumException; 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; +import org.apache.maven.continuum.web.exception.AuthorizationRequiredException; /** * @author Edwin Punzalan - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="releaseCleanup" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="releaseCleanup" */ public class ReleaseCleanupAction extends ContinuumActionSupport - implements SecureAction { private int projectId; @@ -46,13 +39,22 @@ public String execute() throws Exception - { + { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager(); releaseManager.getReleaseResults().remove( releaseId ); - ContinuumReleaseManagerListener listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().remove( releaseId ); + ContinuumReleaseManagerListener listener = + (ContinuumReleaseManagerListener) releaseManager.getListeners().remove( releaseId ); if ( listener != null ) { @@ -96,24 +98,5 @@ } 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -19,25 +19,18 @@ * under the License. */ +import org.apache.maven.continuum.ContinuumException; 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.continuum.web.exception.AuthorizationRequiredException; 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 - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="releaseInProgress" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="releaseInProgress" */ public class ReleaseInProgressAction extends ContinuumActionSupport - implements SecureAction { private int projectId; @@ -54,6 +47,15 @@ public String execute() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } + String status = ""; ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager(); @@ -86,6 +88,14 @@ public String viewResult() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager(); @@ -101,7 +111,7 @@ } else { - throw new Exception( "The release operation with id " + releaseId + "has not finished yet."); + throw new Exception( "The release operation with id " + releaseId + "has not finished yet." ); } } else @@ -169,24 +179,5 @@ } 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -19,31 +19,25 @@ * under the License. */ +import org.apache.maven.continuum.ContinuumException; import org.apache.maven.continuum.model.project.Project; 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.continuum.web.exception.AuthorizationRequiredException; 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; /** * @author Edwin Punzalan - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="releasePerform" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="releasePerform" */ public class ReleasePerformAction extends ContinuumActionSupport - implements SecureAction { private int projectId; @@ -72,6 +66,14 @@ public String inputFromScm() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } populateFromProject(); @@ -83,14 +85,29 @@ public String input() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } return SUCCESS; - } public String execute() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } listener = new DefaultReleaseManagerListener(); @@ -120,7 +137,8 @@ do { releaseId = String.valueOf( System.currentTimeMillis() ); - }while ( releaseManager.getPreparedReleases().containsKey( releaseId ) ); + } + while ( releaseManager.getPreparedReleases().containsKey( releaseId ) ); releaseManager.getPreparedReleases().put( releaseId, descriptor ); @@ -267,24 +285,5 @@ } 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -19,25 +19,22 @@ * under the License. */ +import org.apache.maven.continuum.ContinuumException; import org.apache.maven.continuum.model.project.Project; 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.continuum.web.exception.AuthorizationRequiredException; import org.apache.maven.model.Model; import org.apache.maven.model.Plugin; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository; import org.apache.maven.shared.release.ReleaseResult; -import org.apache.maven.shared.release.versions.VersionInfo; import org.apache.maven.shared.release.versions.DefaultVersionInfo; +import org.apache.maven.shared.release.versions.VersionInfo; +import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; 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; @@ -50,14 +47,10 @@ /** * @author Edwin Punzalan - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="releasePrepare" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="releasePrepare" */ public class ReleasePrepareAction extends ContinuumActionSupport - implements SecureAction { private static final String SCM_SVN_PROTOCOL_PREFIX = "scm:svn"; @@ -94,43 +87,37 @@ public String input() throws Exception { - /* try + try { - if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) ) - { */ - 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 - { - scmTagBase = ""; - } - - prepareGoals = "clean integration-test"; - - getReleasePluginParameters( project.getWorkingDirectory(), "pom.xml" ); - - processProject( project.getWorkingDirectory(), "pom.xml" ); - /* } + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); } - catch ( AuthorizationRequiredException authzE ) + catch ( AuthorizationRequiredException e ) { - addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) + + 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 { - return REQUIRES_AUTHENTICATION; - } */ + scmTagBase = ""; + } + + prepareGoals = "clean integration-test"; + + getReleasePluginParameters( project.getWorkingDirectory(), "pom.xml" ); + + processProject( project.getWorkingDirectory(), "pom.xml" ); return SUCCESS; } @@ -143,12 +130,12 @@ if ( model.getBuild() != null && model.getBuild().getPlugins() != null ) { - for( Iterator plugins = model.getBuild().getPlugins().iterator(); plugins.hasNext(); ) + for ( Iterator plugins = model.getBuild().getPlugins().iterator(); plugins.hasNext(); ) { Plugin plugin = (Plugin) plugins.next(); if ( plugin.getGroupId() != null && plugin.getGroupId().equals( "org.apache.maven.plugins" ) && - plugin.getArtifactId() != null && plugin.getArtifactId().equals( "maven-release-plugin" ) ) + plugin.getArtifactId() != null && plugin.getArtifactId().equals( "maven-release-plugin" ) ) { Xpp3Dom dom = (Xpp3Dom) plugin.getConfiguration(); @@ -183,35 +170,29 @@ public String execute() throws Exception { - /* try + try { - if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) ) - { */ - listener = new DefaultReleaseManagerListener(); - - Project project = getContinuum().getProject( projectId ); - - name = project.getName(); - if ( name == null ) - { - name = project.getArtifactId(); - } - - ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager(); - - releaseId = releaseManager.prepare( project, getReleaseProperties(), getRelVersionMap(), - getDevVersionMap(), listener ); - /* } + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); } - catch ( AuthorizationRequiredException authzE ) + catch ( AuthorizationRequiredException e ) { - addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) + + listener = new DefaultReleaseManagerListener(); + + Project project = getContinuum().getProject( projectId ); + + name = project.getName(); + if ( name == null ) { - return REQUIRES_AUTHENTICATION; - } */ + name = project.getArtifactId(); + } + + ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager(); + + releaseId = + releaseManager.prepare( project, getReleaseProperties(), getRelVersionMap(), getDevVersionMap(), listener ); return SUCCESS; } @@ -219,6 +200,15 @@ public String viewResult() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } + result = (ReleaseResult) getContinuum().getReleaseManager().getReleaseResults().get( releaseId ); return "viewResult"; @@ -227,6 +217,15 @@ public String checkProgress() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } + String status; ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager(); @@ -274,7 +273,7 @@ setProperties( model ); - for( Iterator modules = model.getModules().iterator(); modules.hasNext(); ) + for ( Iterator modules = model.getModules().iterator(); modules.hasNext(); ) { processProject( workingDirectory + "/" + modules.next().toString(), "pom.xml" ); } @@ -493,35 +492,16 @@ public void validate() { - } public String getProjectGroupName() throws ContinuumException { - if ( projectGroupName == null || "".equals( projectGroupName ) ) + if ( StringUtils.isEmpty( 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -20,28 +20,22 @@ */ import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.continuum.ContinuumException; 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.continuum.web.exception.AuthorizationRequiredException; 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 org.codehaus.plexus.util.StringUtils; import java.util.List; import java.util.Map; /** * @author Edwin Punzalan - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="releaseProject" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="releaseProject" */ public class ReleaseProjectAction extends ContinuumActionSupport - implements SecureAction { private int projectId; @@ -64,6 +58,14 @@ public String promptReleaseGoal() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } project = getContinuum().getProjectWithAllDetails( projectId ); @@ -89,6 +91,14 @@ public String execute() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } if ( "prepare".equals( goal ) ) { @@ -194,30 +204,11 @@ public String getProjectGroupName() throws ContinuumException { - if ( projectGroupName == null || "".equals( projectGroupName ) ) + if ( StringUtils.isEmpty( 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -20,27 +20,21 @@ */ import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.continuum.ContinuumException; 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.continuum.web.exception.AuthorizationRequiredException; 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 org.codehaus.plexus.util.StringUtils; import java.util.Map; /** * @author Edwin Punzalan - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="releaseProjectGoal" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="releaseProjectGoal" */ public class ReleaseProjectGoalAction extends ContinuumActionSupport - implements SecureAction { private int projectId; @@ -57,6 +51,15 @@ public String execute() throws Exception { + try + { + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } + Project project = getContinuum().getProjectWithAllDetails( projectId ); String releaseId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ); @@ -75,7 +78,6 @@ projectName = project.getName(); - return SUCCESS; } @@ -132,30 +134,11 @@ public String getProjectGroupName() throws ContinuumException { - if ( projectGroupName == null || "".equals( projectGroupName ) ) + if ( StringUtils.isEmpty( 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -19,26 +19,20 @@ * under the License. */ +import org.apache.maven.continuum.ContinuumException; +import org.apache.maven.continuum.model.project.Project; 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.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; +import org.apache.maven.continuum.web.exception.AuthorizationRequiredException; +import org.codehaus.plexus.util.StringUtils; /** * @author Edwin Punzalan - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="releaseRollback" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="releaseRollback" */ public class ReleaseRollbackAction extends ContinuumActionSupport - implements SecureAction { private int projectId; @@ -49,43 +43,37 @@ public String execute() throws Exception { - /*try + try { - if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) ) - { */ - ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager(); + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } - ContinuumReleaseManagerListener listener = new DefaultReleaseManagerListener(); + ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager(); - Project project = getContinuum().getProject( projectId ); + ContinuumReleaseManagerListener listener = new DefaultReleaseManagerListener(); - releaseManager.rollback( releaseId, project.getWorkingDirectory(), listener ); + Project project = getContinuum().getProject( projectId ); - //recurse until rollback is finished - while( listener.getState() != ContinuumReleaseManagerListener.FINISHED ) - { - try - { - Thread.sleep( 1000 ); - } - catch( InterruptedException e ) - { - //do nothing - } - } + releaseManager.rollback( releaseId, project.getWorkingDirectory(), listener ); - releaseManager.getPreparedReleases().remove( releaseId ); - /* } - } - catch ( AuthorizationRequiredException authzE ) + //recurse until rollback is finished + while ( listener.getState() != ContinuumReleaseManagerListener.FINISHED ) { - addActionError( authzE.getMessage() ); - return REQUIRES_AUTHORIZATION; + try + { + Thread.sleep( 1000 ); + } + catch ( InterruptedException e ) + { + //do nothing + } } - catch ( AuthenticationRequiredException authnE ) - { - return REQUIRES_AUTHENTICATION; - } */ + + releaseManager.getPreparedReleases().remove( releaseId ); return SUCCESS; } @@ -93,23 +81,15 @@ public String warn() throws Exception { - /*try + try { - if ( isAuthorizedBuildProjectGroup( getProjectGroupName() ) ) - { - return SUCCESS; - } + checkBuildProjectInGroupAuthorization( getProjectGroupName() ); } - catch ( AuthorizationRequiredException authzE ) + catch ( AuthorizationRequiredException e ) { - addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) - { - return REQUIRES_AUTHENTICATION; - } */ - + return SUCCESS; } @@ -136,30 +116,11 @@ public String getProjectGroupName() throws ContinuumException { - if ( projectGroupName == null || "".equals( projectGroupName ) ) + if ( StringUtils.isEmpty( 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -20,13 +20,10 @@ */ 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.exception.AuthorizationRequiredException; 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; @@ -39,12 +36,10 @@ * * @author Emmanuel Venisse * @version $Id$ - * @plexus.component role="com.opensymphony.xwork.Action" - * role-hint="summary" + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="summary" */ public class SummaryAction extends ContinuumActionSupport - implements SecureAction { private int projectGroupId; @@ -55,6 +50,16 @@ public String execute() throws ContinuumException { + try + { + checkViewProjectGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException authzE ) + { + addActionError( authzE.getMessage() ); + return REQUIRES_AUTHORIZATION; + } + Collection projectsInGroup; //TODO: Create a summary jpox request so code will be more simple and performance will be better @@ -151,16 +156,4 @@ { 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -20,15 +20,13 @@ */ 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.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.codehaus.plexus.util.DirectoryScanner; +import org.codehaus.plexus.util.StringUtils; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; @@ -50,16 +48,11 @@ /** * @author Edwin Punzalan - * - * @plexus.component - * role="com.opensymphony.xwork.Action" - * role-hint="surefireReport" - * - * @todo too many inner classes, maybe a continuum-reports project group ? + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="surefireReport" + * @todo too many inner classes, maybe a continuum-reports project group ? */ public class SurefireReportAction extends ContinuumActionSupport - implements SecureAction { private int buildId; @@ -78,6 +71,15 @@ public String execute() throws ContinuumException { + try + { + checkViewProjectGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } + project = getProjectById( projectId ); //@todo maven-surefire-report reportsDirectory should be detected ? @@ -136,7 +138,7 @@ float totalTime = 0.0f; - for( Iterator suites = suiteList.iterator(); suites.hasNext(); ) + for ( Iterator suites = suiteList.iterator(); suites.hasNext(); ) { ReportTestSuite suite = (ReportTestSuite) suites.next(); @@ -162,7 +164,7 @@ { Map testsByPackage = new LinkedHashMap(); - for( Iterator suites = suiteList.iterator(); suites.hasNext(); ) + for ( Iterator suites = suiteList.iterator(); suites.hasNext(); ) { ReportTestSuite suite = (ReportTestSuite) suites.next(); @@ -537,7 +539,7 @@ { String s = new String( ch, start, length ); - if ( ! "".equals( s.trim() ) ) + if ( !"".equals( s.trim() ) ) { currentElement.append( s ); } @@ -752,7 +754,7 @@ } public Project getProjectById( int projectId ) - throws ContinuumException + throws ContinuumException { return getContinuum().getProject( projectId ); } @@ -761,23 +763,5 @@ 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -23,11 +23,9 @@ import com.opensymphony.webwork.views.util.UrlHelper; 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.exception.AuthorizationRequiredException; import org.apache.maven.continuum.web.util.WorkingCopyContentGenerator; -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.codehaus.plexus.util.StringUtils; import javax.activation.MimetypesFileTypeMap; import java.io.File; @@ -44,7 +42,6 @@ */ public class WorkingCopyAction extends ContinuumActionSupport - implements SecureAction { /** * @plexus.requirement @@ -78,6 +75,14 @@ public String execute() throws ContinuumException { + try + { + checkViewProjectGroupAuthorization( getProjectGroupName() ); + } + catch ( AuthorizationRequiredException e ) + { + return REQUIRES_AUTHORIZATION; + } files = getContinuum().getFiles( projectId, userDirectory ); @@ -219,29 +224,11 @@ public String getProjectGroupName() throws ContinuumException { - if( projectGroupName == null || "".equals( projectGroupName ) ) + if ( StringUtils.isEmpty( 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_VIEW_GROUP_OPERATION, - getProjectGroupName() ); - } - catch ( ContinuumException ce ) - { - - } - - 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -24,9 +24,8 @@ import org.apache.maven.continuum.model.project.Project; 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 org.apache.maven.continuum.web.model.BuildDefinitionSummary; import java.util.ArrayList; import java.util.Iterator; @@ -64,14 +63,13 @@ projectGroupId = projectGroup.getId(); projectGroupName = projectGroup.getName(); - if ( isAuthorizedViewProjectGroup( projectGroupName ) ) - { - groupBuildDefinitionSummaries = gatherGroupBuildDefinitionSummaries( projectGroupId ); - projectBuildDefinitionSummaries = gatherProjectBuildDefinitionSummaries( projectId ); + checkViewProjectGroupAuthorization( projectGroupName ); - allBuildDefinitionSummaries.addAll( groupBuildDefinitionSummaries ); - allBuildDefinitionSummaries.addAll( projectBuildDefinitionSummaries ); - } + groupBuildDefinitionSummaries = gatherGroupBuildDefinitionSummaries( projectGroupId ); + projectBuildDefinitionSummaries = gatherProjectBuildDefinitionSummaries( projectId ); + + allBuildDefinitionSummaries.addAll( groupBuildDefinitionSummaries ); + allBuildDefinitionSummaries.addAll( projectBuildDefinitionSummaries ); } catch ( ContinuumException e ) { @@ -83,10 +81,6 @@ addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) - { - return REQUIRES_AUTHENTICATION; - } return SUCCESS; } @@ -99,18 +93,17 @@ projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId ); - if ( isAuthorizedViewProjectGroup( projectGroup.getName() ) ) - { - for ( Iterator i = projectGroup.getProjects().iterator(); i.hasNext(); ) - { - Project project = (Project) i.next(); - projectBuildDefinitionSummaries.addAll( gatherProjectBuildDefinitionSummaries( project.getId() ) ); + checkViewProjectGroupAuthorization( projectGroup.getName() ); - } + 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 ) { @@ -121,10 +114,6 @@ { 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -27,9 +27,8 @@ 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.web.model.NotifierSummary; import org.apache.maven.continuum.web.exception.AuthorizationRequiredException; -import org.apache.maven.continuum.web.exception.AuthenticationRequiredException; +import org.apache.maven.continuum.web.model.NotifierSummary; import java.util.ArrayList; import java.util.Collection; @@ -82,10 +81,9 @@ try { - if ( isAuthorizedViewProjectGroup( getProjectGroupName() ) ) - { - projectNotifierSummaries = summarizeForProject( projectId ); - } + checkViewProjectGroupAuthorization( getProjectGroupName() ); + + projectNotifierSummaries = summarizeForProject( projectId ); } catch ( ContinuumException e ) { @@ -97,10 +95,6 @@ addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) - { - return REQUIRES_AUTHENTICATION; - } return SUCCESS; } @@ -128,18 +122,17 @@ try { - if ( isAuthorizedViewProjectGroup( getProjectGroupName() ) ) - { - projectGroupNotifierSummaries = gatherGroupNotifierSummaries(); + checkViewProjectGroupAuthorization( getProjectGroupName() ); + + projectGroupNotifierSummaries = gatherGroupNotifierSummaries(); - Collection projects = getContinuum().getProjectsInGroup( projectGroupId ); - if ( projects != null ) + Collection projects = getContinuum().getProjectsInGroup( projectGroupId ); + if ( projects != null ) + { + for ( Iterator i = projects.iterator(); i.hasNext(); ) { - for ( Iterator i = projects.iterator(); i.hasNext(); ) - { - Project p = (Project) i.next(); - projectNotifierSummaries.addAll( summarizeForProject( p.getId() ) ); - } + Project p = (Project) i.next(); + projectNotifierSummaries.addAll( summarizeForProject( p.getId() ) ); } } } @@ -153,10 +146,6 @@ addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) - { - return REQUIRES_AUTHENTICATION; - } return SUCCESS; } @@ -413,7 +402,7 @@ } else { - projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName(); + projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName(); } } 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -20,10 +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.ProjectGroup; import org.apache.maven.continuum.model.project.ProjectNotifier; +import org.apache.maven.continuum.web.exception.AuthorizationRequiredException; +import org.codehaus.plexus.util.StringUtils; /** * Common base class for all Project Group notifier edit actions. @@ -90,23 +90,23 @@ this.projectGroupId = projectGroupId; } - protected boolean isAuthorized() - throws AuthorizationRequiredException, AuthenticationRequiredException, ContinuumException + protected void checkAuthorization() + throws AuthorizationRequiredException, ContinuumException { - if( getNotifier() == null ) + if ( getNotifier() == null ) { - return isAuthorizedAddProjectGroupNotifier( getProjectGroupName() ); + checkAddProjectGroupNotifierAuthorization( getProjectGroupName() ); } else { - return isAuthorizedModifyProjectGroupNotifier( getProjectGroupName() ); + checkModifyProjectGroupNotifierAuthorization( getProjectGroupName() ); } } public String getProjectGroupName() throws ContinuumException { - if( projectGroupName == null || "".equals( projectGroupName ) ) + if ( StringUtils.isEmpty( projectGroupName ) ) { projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName(); } 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=510547&r1=510546&r2=510547 ============================================================================== --- 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 Thu Feb 22 07:24:47 2007 @@ -23,7 +23,6 @@ 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; @@ -74,7 +73,7 @@ * for the build. */ private boolean sendOnWarning; - + /** * Detemines if the save operation returns to the project group notifier page or not.

* true implies return to the project group notifier page. @@ -109,47 +108,42 @@ public String save() throws ContinuumException { - ProjectNotifier notifier = getNotifier(); - try { - boolean isNew = ( notifier == null || getNotifierId() == 0 ); + checkAuthorization(); + } + catch ( AuthorizationRequiredException authzE ) + { + addActionError( authzE.getMessage() ); + return REQUIRES_AUTHORIZATION; + } - if ( isNew ) - { - notifier = new ProjectNotifier(); - } + ProjectNotifier notifier = getNotifier(); - if( isAuthorized() ) - { - notifier.setType( getNotifierType() ); + boolean isNew = ( notifier == null || getNotifierId() == 0 ); - notifier.setSendOnSuccess( isSendOnSuccess() ); + if ( isNew ) + { + notifier = new ProjectNotifier(); + } - notifier.setSendOnFailure( isSendOnFailure() ); + notifier.setType( getNotifierType() ); - notifier.setSendOnError( isSendOnError() ); + notifier.setSendOnSuccess( isSendOnSuccess() ); - notifier.setSendOnWarning( isSendOnWarning() ); + notifier.setSendOnFailure( isSendOnFailure() ); - setNotifierConfiguration( notifier ); + notifier.setSendOnError( isSendOnError() ); - saveNotifier( notifier ); + notifier.setSendOnWarning( isSendOnWarning() ); - if ( fromGroupPage ) - { - return "to_group_page"; - } - } - } - catch ( AuthorizationRequiredException authzE ) - { - addActionError( authzE.getMessage() ); - return REQUIRES_AUTHORIZATION; - } - catch ( AuthenticationRequiredException authnE ) + setNotifierConfiguration( notifier ); + + saveNotifier( notifier ); + + if ( fromGroupPage ) { - return REQUIRES_AUTHENTICATION; + return "to_group_page"; } return SUCCESS; @@ -173,31 +167,26 @@ try { - if ( isAuthorized() ) - { - // setup Action fields - setNotifierType( notifier.getType() ); - - setSendOnSuccess( notifier.isSendOnSuccess() ); - - setSendOnFailure( notifier.isSendOnFailure() ); - - setSendOnError( notifier.isSendOnError() ); - - setSendOnWarning( notifier.isSendOnWarning() ); - - initConfiguration( notifier.getConfiguration() ); - } + checkAuthorization(); } catch ( AuthorizationRequiredException authzE ) { addActionError( authzE.getMessage() ); return REQUIRES_AUTHORIZATION; } - catch ( AuthenticationRequiredException authnE ) - { - return REQUIRES_AUTHENTICATION; - } + + // setup Action fields + setNotifierType( notifier.getType() ); + + setSendOnSuccess( notifier.isSendOnSuccess() ); + + setSendOnFailure( notifier.isSendOnFailure() ); + + setSendOnError( notifier.isSendOnError() ); + + setSendOnWarning( notifier.isSendOnWarning() ); + + initConfiguration( notifier.getConfiguration() ); return SUCCESS; } @@ -328,6 +317,6 @@ */ protected abstract void setNotifierConfiguration( ProjectNotifier notifier ); - protected abstract boolean isAuthorized() throws AuthorizationRequiredException, - AuthenticationRequiredException, ContinuumException; + protected abstract void checkAuthorization() + throws AuthorizationRequiredException, ContinuumException; }