You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2007/02/22 16:24:51 UTC
svn commit: r510547 [1/3] - in
/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action:
./ component/ notifier/
Author: evenisse
Date: Thu Feb 22 07:24:47 2007
New Revision: 510547
URL: http://svn.apache.org/viewvc?view=rev&rev=510547
Log:
o Remove duplicated code in ContinuumActionSupport
o Rename all isAuthorized* methods by check*Authorization
o Remove some unneeded SecureAction implementation (need more work)
Modified:
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectViewAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseCleanupAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectGoalAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/WorkingCopyAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/NotifierSummaryAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractGroupNotifierEditAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractNotifierEditActionSupport.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AbstractProjectNotifierEditAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddGroupNotifierAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/AddProjectNotifierAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteGroupNotifierAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/DeleteProjectNotifierAction.java
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java Thu Feb 22 07:24:47 2007
@@ -22,23 +22,17 @@
import com.opensymphony.xwork.Validateable;
import org.apache.maven.continuum.ContinuumException;
import org.apache.maven.continuum.model.project.ProjectGroup;
-import org.apache.maven.continuum.security.ContinuumRoleConstants;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
import java.util.Iterator;
/**
* @author Henry Isidro <hi...@exist.com>
- *
- * @plexus.component
- * role="com.opensymphony.xwork.Action"
- * role-hint="addProjectGroup"
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="addProjectGroup"
*/
public class AddProjectGroupAction
extends ContinuumActionSupport
- implements Validateable, SecureAction
+ implements Validateable
{
private String name;
@@ -74,26 +68,51 @@
public String execute()
{
- ProjectGroup projectGroup = new ProjectGroup();
+ try
+ {
+ checkAddProjectGroupAuthorization();
- projectGroup.setName( name );
+ ProjectGroup projectGroup = new ProjectGroup();
- projectGroup.setGroupId( groupId );
+ projectGroup.setName( name );
- projectGroup.setDescription( description );
+ projectGroup.setGroupId( groupId );
- try
+ projectGroup.setDescription( description );
+
+ try
+ {
+ getContinuum().addProjectGroup( projectGroup );
+ }
+ catch ( ContinuumException e )
+ {
+ getLogger().error( "Error adding project group: " + e.getLocalizedMessage() );
+
+ return ERROR;
+ }
+
+ return SUCCESS;
+ }
+ catch ( AuthorizationRequiredException authzE )
{
- getContinuum().addProjectGroup( projectGroup );
+ addActionError( authzE.getMessage() );
+ return REQUIRES_AUTHORIZATION;
}
- catch ( ContinuumException e )
+ }
+
+ public String input()
+ {
+ try
{
- getLogger().error( "Error adding project group: " + e.getLocalizedMessage() );
+ checkAddProjectGroupAuthorization();
- return ERROR;
+ return INPUT;
+ }
+ catch ( AuthorizationRequiredException authzE )
+ {
+ addActionError( authzE.getMessage() );
+ return REQUIRES_AUTHORIZATION;
}
-
- return SUCCESS;
}
public String getDescription()
@@ -125,15 +144,4 @@
{
this.name = name;
}
-
- public SecureActionBundle getSecureActionBundle()
- throws SecureActionException
- {
- SecureActionBundle bundle = new SecureActionBundle();
- bundle.setRequiresAuthentication( true );
- bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_GROUP_OPERATION );
-
- return bundle;
- }
-
}
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java Thu Feb 22 07:24:47 2007
@@ -21,17 +21,16 @@
import org.apache.maven.continuum.ContinuumException;
import org.apache.maven.continuum.model.project.BuildDefinition;
-import org.apache.maven.continuum.model.project.Schedule;
import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.web.exception.ContinuumActionException;
+import org.apache.maven.continuum.model.project.Schedule;
import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
-import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
+import org.apache.maven.continuum.web.exception.ContinuumActionException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
import java.util.List;
+import java.util.Map;
/**
* BuildDefinitionAction:
@@ -122,7 +121,7 @@
{
List projects = getContinuum().getProjectGroupWithProjects( projectGroupId ).getProjects();
- if( projects.size() > 0 )
+ if ( projects.size() > 0 )
{
Project project = (Project) projects.get( 0 );
executor = project.getExecutorId();
@@ -132,42 +131,48 @@
if ( buildDefinitionId != 0 )
{
- if( isAuthorizedModifyProjectBuildDefinition( getProjectGroupName() ) ||
- isAuthorizedModifyGroupBuildDefinition( getProjectGroupName() ) )
+ if ( projectId != 0 )
+ {
+ checkModifyProjectBuildDefinitionAuthorization( getProjectGroupName() );
+ }
+ else
{
- BuildDefinition buildDefinition = getContinuum().getBuildDefinition( buildDefinitionId );
- goals = buildDefinition.getGoals();
- arguments = buildDefinition.getArguments();
- buildFile = buildDefinition.getBuildFile();
- buildFresh = buildDefinition.isBuildFresh();
- scheduleId = buildDefinition.getSchedule().getId();
- defaultBuildDefinition = buildDefinition.isDefaultForProject();
+ checkModifyGroupBuildDefinitionAuthorization( getProjectGroupName() );
}
+
+ BuildDefinition buildDefinition = getContinuum().getBuildDefinition( buildDefinitionId );
+ goals = buildDefinition.getGoals();
+ arguments = buildDefinition.getArguments();
+ buildFile = buildDefinition.getBuildFile();
+ buildFresh = buildDefinition.isBuildFresh();
+ scheduleId = buildDefinition.getSchedule().getId();
+ defaultBuildDefinition = buildDefinition.isDefaultForProject();
}
else
{
- if( isAuthorizedAddProjectBuildDefinition( getProjectGroupName() ) ||
- isAuthorizedAddGroupBuildDefinition( getProjectGroupName() ) )
+ if ( projectId != 0 )
{
- if ( "maven2".equals(executor) )
- {
- buildFile = "pom.xml";
- }
- else if ( "maven-1".equals(executor) )
- {
- buildFile = "project.xml";
- }
- else if ( "ant".equals(executor) )
- {
- buildFile = "build.xml";
- }
+ checkAddProjectBuildDefinitionAuthorization( getProjectGroupName() );
+ }
+ else
+ {
+ checkAddGroupBuildDefinitionAuthorization( getProjectGroupName() );
+ }
+
+ if ( "maven2".equals( executor ) )
+ {
+ buildFile = "pom.xml";
+ }
+ else if ( "maven-1".equals( executor ) )
+ {
+ buildFile = "project.xml";
+ }
+ else if ( "ant".equals( executor ) )
+ {
+ buildFile = "build.xml";
}
}
}
- catch ( AuthenticationRequiredException authnE )
- {
- return REQUIRES_AUTHENTICATION;
- }
catch ( AuthorizationRequiredException authzE )
{
return REQUIRES_AUTHORIZATION;
@@ -179,7 +184,7 @@
public String saveBuildDefinition()
throws ContinuumException
{
- if ( projectId != 0 && !groupBuildDefinition )
+ if ( projectId != 0 && !groupBuildDefinition )
{
return saveToProject();
}
@@ -197,17 +202,15 @@
{
if ( buildDefinitionId == 0 )
{
- if ( isAuthorizedAddProjectBuildDefinition( getProjectGroupName() ) )
- {
- getContinuum().addBuildDefinitionToProject( projectId, getBuildDefinitionFromInput() );
- }
+ checkAddProjectBuildDefinitionAuthorization( getProjectGroupName() );
+
+ getContinuum().addBuildDefinitionToProject( projectId, getBuildDefinitionFromInput() );
}
else
{
- if( isAuthorizedModifyProjectBuildDefinition( getProjectGroupName() ) )
- {
- getContinuum().updateBuildDefinitionForProject( projectId, getBuildDefinitionFromInput() );
- }
+ checkModifyProjectBuildDefinitionAuthorization( getProjectGroupName() );
+
+ getContinuum().updateBuildDefinitionForProject( projectId, getBuildDefinitionFromInput() );
}
}
catch ( ContinuumActionException cae )
@@ -220,10 +223,6 @@
addActionError( authzE.getMessage() );
return REQUIRES_AUTHORIZATION;
}
- catch ( AuthenticationRequiredException authnE )
- {
- return REQUIRES_AUTHENTICATION;
- }
return SUCCESS;
}
@@ -234,25 +233,23 @@
try
{
BuildDefinition newBuildDef = getBuildDefinitionFromInput();
-
+
if ( getContinuum().getBuildDefinitionsForProjectGroup( projectGroupId ).size() == 0 )
{
newBuildDef.setDefaultForProject( true );
}
-
+
if ( buildDefinitionId == 0 )
{
- if ( isAuthorizedAddGroupBuildDefinition( getProjectGroupName() ) )
- {
- getContinuum().addBuildDefinitionToProjectGroup( projectGroupId, newBuildDef );
- }
+ checkAddGroupBuildDefinitionAuthorization( getProjectGroupName() );
+
+ getContinuum().addBuildDefinitionToProjectGroup( projectGroupId, newBuildDef );
}
else
{
- if ( isAuthorizedModifyGroupBuildDefinition( getProjectGroupName() ) )
- {
- getContinuum().updateBuildDefinitionForProjectGroup( projectGroupId, newBuildDef );
- }
+ checkModifyGroupBuildDefinitionAuthorization( getProjectGroupName() );
+
+ getContinuum().updateBuildDefinitionForProjectGroup( projectGroupId, newBuildDef );
}
}
catch ( ContinuumActionException cae )
@@ -265,10 +262,6 @@
addActionError( authzE.getMessage() );
return REQUIRES_AUTHORIZATION;
}
- catch ( AuthenticationRequiredException authnE )
- {
- return REQUIRES_AUTHENTICATION;
- }
if ( projectId != 0 )
{
@@ -285,18 +278,17 @@
{
try
{
- if ( isAuthorizedRemoveProjectFromGroup( getProjectGroupName() ) )
+ checkRemoveProjectBuildDefinitionAuthorization( getProjectGroupName() );
+
+ if ( confirmed )
{
- if ( confirmed )
- {
- getContinuum().removeBuildDefinitionFromProject( projectId, buildDefinitionId );
+ getContinuum().removeBuildDefinitionFromProject( projectId, buildDefinitionId );
- return SUCCESS;
- }
- else
- {
- return CONFIRM;
- }
+ return SUCCESS;
+ }
+ else
+ {
+ return CONFIRM;
}
}
catch ( AuthorizationRequiredException authzE )
@@ -304,12 +296,6 @@
addActionError( authzE.getMessage() );
return REQUIRES_AUTHORIZATION;
}
- catch ( AuthenticationRequiredException authnE )
- {
- return REQUIRES_AUTHENTICATION;
- }
-
- return SUCCESS;
}
public String removeFromProjectGroup()
@@ -317,18 +303,17 @@
{
try
{
- if ( isAuthorizedRemoveProjectGroup( getProjectGroupName() ) )
+ checkRemoveGroupBuildDefinitionAuthorization( getProjectGroupName() );
+
+ if ( confirmed )
{
- if ( confirmed )
- {
- getContinuum().removeBuildDefinitionFromProjectGroup( projectGroupId, buildDefinitionId );
+ getContinuum().removeBuildDefinitionFromProjectGroup( projectGroupId, buildDefinitionId );
- return SUCCESS;
- }
- else
- {
- return CONFIRM;
- }
+ return SUCCESS;
+ }
+ else
+ {
+ return CONFIRM;
}
}
catch ( AuthorizationRequiredException authzE )
@@ -336,12 +321,6 @@
addActionError( authzE.getMessage() );
return REQUIRES_AUTHORIZATION;
}
- catch ( AuthenticationRequiredException authnE )
- {
- return REQUIRES_AUTHENTICATION;
- }
-
- return SUCCESS;
}
private BuildDefinition getBuildDefinitionFromInput()
@@ -527,10 +506,10 @@
}
else
{
- projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+ projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
}
}
-
+
return projectGroupName;
}
}
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.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.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 <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
- *
- * @plexus.component
- * role="com.opensymphony.xwork.Action"
- * role-hint="buildProject"
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="buildProject"
*/
public class BuildProjectAction
extends ContinuumActionSupport
- implements SecureAction
{
private int projectId;
@@ -52,7 +45,15 @@
public String execute()
throws ContinuumException
- {
+ {
+ try
+ {
+ checkBuildProjectInGroupAuthorization( getProjectGroupName() );
+ }
+ catch ( AuthorizationRequiredException e )
+ {
+ return REQUIRES_AUTHORIZATION;
+ }
if ( projectId > 0 )
{
@@ -89,7 +90,6 @@
}
}
-
return SUCCESS;
}
@@ -146,7 +146,7 @@
public String getProjectGroupName()
throws ContinuumException
{
- if( projectGroupName == null || "".equals( projectGroupName ) )
+ if ( StringUtils.isEmpty( projectGroupName ) )
{
if ( projectGroupId != 0 )
{
@@ -159,24 +159,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 e )
- {
- throw new SecureActionException( e.getMessage() );
- }
-
- return bundle;
}
}
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java Thu Feb 22 07:24:47 2007
@@ -19,34 +19,27 @@
* under the License.
*/
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
+import com.opensymphony.webwork.ServletActionContext;
import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.security.ContinuumRoleConstants;
-import org.apache.maven.continuum.web.util.StateGenerator;
import org.apache.maven.continuum.configuration.ConfigurationException;
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.util.StateGenerator;
import org.codehaus.plexus.util.FileUtils;
-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 com.opensymphony.webwork.ServletActionContext;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
- *
- * @plexus.component
- * role="com.opensymphony.xwork.Action"
- * role-hint="buildResult"
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="buildResult"
*/
public class BuildResultAction
extends ContinuumActionSupport
- implements SecureAction
{
private Project project;
@@ -69,6 +62,14 @@
public String execute()
throws ContinuumException, ConfigurationException, IOException
{
+ try
+ {
+ checkViewProjectGroupAuthorization( getProjectGroupName() );
+ }
+ catch ( AuthorizationRequiredException e )
+ {
+ return REQUIRES_AUTHORIZATION;
+ }
//todo get this working for other types of test case rendering other then just surefire
// check if there are surefire results to display
@@ -88,7 +89,6 @@
state = StateGenerator.generate( buildResult.getState(), ServletActionContext.getRequest().getContextPath() );
-
return SUCCESS;
}
@@ -151,31 +151,11 @@
public String getProjectGroupName()
throws ContinuumException
{
- if( projectGroupName == null || "".equals( projectGroupName ) )
- {
+ if ( StringUtils.isEmpty( projectGroupName ) )
+ {
projectGroupName = getContinuum().getProjectGroupByProjectId( getProjectId() ).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 e )
- {
-
- }
-
- return bundle;
- }
-
}
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java Thu Feb 22 07:24:47 2007
@@ -20,25 +20,19 @@
*/
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.SecureActionBundle;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
-import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.codehaus.plexus.util.StringUtils;
import java.util.Collection;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
- *
- * @plexus.component
- * role="com.opensymphony.xwork.Action"
- * role-hint="buildResults"
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="buildResults"
*/
public class BuildResultsListAction
extends ContinuumActionSupport
- implements SecureAction
{
private Project project;
@@ -53,6 +47,15 @@
public String execute()
throws ContinuumException
{
+ try
+ {
+ checkViewProjectGroupAuthorization( getProjectGroupName() );
+ }
+ catch ( AuthorizationRequiredException e )
+ {
+ return REQUIRES_AUTHORIZATION;
+ }
+
project = getContinuum().getProject( projectId );
buildResults = getContinuum().getBuildResultsForProject( projectId );
@@ -93,29 +96,11 @@
public String getProjectGroupName()
throws ContinuumException
{
- if( projectGroupName == null || "".equals( projectGroupName ) )
+ if ( StringUtils.isEmpty( projectGroupName ) )
{
projectGroupName = getContinuum().getProject( projectId ).getProjectGroup().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 e )
- {
- throw new SecureActionException( e.getMessage() );
- }
-
- return bundle;
}
}
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java Thu Feb 22 07:24:47 2007
@@ -20,25 +20,23 @@
*/
import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.security.ContinuumRoleConstants;
import org.apache.maven.continuum.buildqueue.BuildProjectTask;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
import org.codehaus.plexus.taskqueue.Task;
import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
-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;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
- *
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="cancelBuild"
*/
public class CancelBuildAction
extends ContinuumActionSupport
- implements SecureAction
{
- /** @plexus.requirement role-hint='build-project' */
+ /**
+ * @plexus.requirement role-hint='build-project'
+ */
private TaskQueueExecutor taskQueueExecutor;
private int projectId;
@@ -48,10 +46,18 @@
public String execute()
throws ContinuumException
{
+ try
+ {
+ checkBuildProjectInGroupAuthorization( getProjectGroupName() );
+ }
+ catch ( AuthorizationRequiredException e )
+ {
+ return REQUIRES_AUTHORIZATION;
+ }
Task task = taskQueueExecutor.getCurrentTask();
- getLogger().info("TaskQueueExecutor: " + taskQueueExecutor );
+ getLogger().info( "TaskQueueExecutor: " + taskQueueExecutor );
if ( task != null )
{
@@ -64,8 +70,8 @@
}
else
{
- getLogger().warn( "Current task is not for the given projectId (" + projectId + "): "
- + ( (BuildProjectTask) task ).getProjectId() + "; not cancelling" );
+ getLogger().warn( "Current task is not for the given projectId (" + projectId + "): " +
+ ( (BuildProjectTask) task ).getProjectId() + "; not cancelling" );
}
}
else
@@ -78,7 +84,6 @@
getLogger().warn( "No task running - not cancelling" );
}
-
return SUCCESS;
}
@@ -90,29 +95,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 e )
- {
- throw new SecureActionException( e.getMessage() );
- }
-
- return bundle;
}
}
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java?view=diff&rev=510547&r1=510546&r2=510547
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java Thu Feb 22 07:24:47 2007
@@ -19,19 +19,18 @@
* under the License.
*/
+import com.opensymphony.xwork.ActionContext;
+import com.opensymphony.xwork.Preparable;
import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.security.ContinuumRoleConstants;
import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
-import org.apache.maven.continuum.security.ContinuumRoleConstants;
-import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+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.security.authorization.AuthorizationException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-
-import com.opensymphony.xwork.Preparable;
-import com.opensymphony.xwork.ActionContext;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
/**
* ContinuumActionSupport
@@ -42,7 +41,7 @@
public class ContinuumActionSupport
extends PlexusActionSupport
implements Preparable
-{
+{
private SecuritySession securitySession;
/**
@@ -57,7 +56,8 @@
protected static final String ERROR_MSG_AUTHORIZATION_REQUIRED = "You are not authorized to access this page. " +
"Please contact your administrator to be granted the appropriate permissions.";
- protected static final String ERROR_MSG_PROCESSING_AUTHORIZATION = "An error occurred while performing authorization.";
+ protected static final String ERROR_MSG_PROCESSING_AUTHORIZATION =
+ "An error occurred while performing authorization.";
/**
* @plexus.requirement
@@ -67,9 +67,10 @@
public void prepare()
throws Exception
{
- if( securitySession == null )
+ if ( securitySession == null )
{
- securitySession = (SecuritySession) getContext().getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );
+ securitySession =
+ (SecuritySession) getContext().getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );
}
}
@@ -84,570 +85,194 @@
}
/**
- * Check if the current user is authorized to view the specified project group
+ * Check if the current user is authorized to do the action
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param role the role
+ * @throws AuthorizationRequiredException if the user isn't authorized
*/
- protected boolean isAuthorizedViewProjectGroup( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkAuthorization( String role )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
+ checkAuthorization( role, null );
+ }
+ /**
+ * Check if the current user is authorized to do the action
+ *
+ * @param role the role
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized
+ */
+ protected void checkAuthorization( String role, String resource )
+ throws AuthorizationRequiredException
+ {
try
{
- if ( resource != null && !"".equals( resource.trim() ) )
+ if ( resource != null && StringUtils.isNotEmpty( resource.trim() ) )
{
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION, resource ) )
+ if ( !getSecuritySystem().isAuthorized( getSecuritySession(), role, resource ) )
{
throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
}
}
else
{
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION ) )
+ if ( !getSecuritySystem().isAuthorized( getSecuritySession(), role ) )
{
throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
}
}
}
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
catch ( AuthorizationException ae )
{
throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
}
-
- return true;
}
/**
- * Check if the current user is authorized to add a project group
+ * Check if the current user is authorized to view the specified project group
*
* @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedAddProjectGroup( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkViewProjectGroupAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_GROUP_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_GROUP_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION, resource );
+ }
- return true;
+ /**
+ * Check if the current user is authorized to add a project group
+ *
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
+ */
+ protected void checkAddProjectGroupAuthorization()
+ throws AuthorizationRequiredException
+ {
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_GROUP_OPERATION );
}
/**
* Check if the current user is authorized to delete the specified project group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedRemoveProjectGroup( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkRemoveProjectGroupAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_OPERATION, resource );
}
/**
* Check if the current user is authorized to build the specified project group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedBuildProjectGroup( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkBuildProjectGroupAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_BUILD_GROUP_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_BUILD_GROUP_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_BUILD_GROUP_OPERATION, resource );
}
/**
* Check if the current user is authorized to modify the specified project group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedModifyProjectGroup( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkModifyProjectGroupAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_GROUP_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_GROUP_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_MODIFY_GROUP_OPERATION, resource );
}
/**
* Check if the current user is authorized to add a project to a specific project group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedAddProjectToGroup( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkAddProjectToGroupAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_TO_GROUP_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_TO_GROUP_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_TO_GROUP_OPERATION, resource );
}
/**
* Check if the current user is authorized to delete a project from a specified group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedRemoveProjectFromGroup( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkRemoveProjectFromGroupAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_FROM_GROUP_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_FROM_GROUP_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_FROM_GROUP_OPERATION, resource );
}
/**
* Check if the current user is authorized to modify a project in the specified group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedModifyProjectInGroup( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkModifyProjectInGroupAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_IN_GROUP_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_IN_GROUP_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_IN_GROUP_OPERATION, resource );
}
/**
* Check if the current user is authorized to build a project in the specified group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedBuildProjectInGroup( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkBuildProjectInGroupAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_BUILD_PROJECT_IN_GROUP_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_BUILD_PROJECT_IN_GROUP_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
- }
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_BUILD_PROJECT_IN_GROUP_OPERATION, resource );
+ }
/**
* Check if the current user is authorized to add a build definition for the specified
* project group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedAddGroupBuildDefinition( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkAddGroupBuildDefinitionAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_GROUP_BUILD_DEFINTION_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_GROUP_BUILD_DEFINTION_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_GROUP_BUILD_DEFINTION_OPERATION, resource );
}
/**
* Check if the current user is authorized to delete a build definition in the specified
* project group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedRemoveGroupBuildDefinition( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkRemoveGroupBuildDefinitionAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_BUILD_DEFINITION_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_BUILD_DEFINITION_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_BUILD_DEFINITION_OPERATION, resource );
}
/**
* Check if the current user is authorized to modify a build definition in the specified
* project group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedModifyGroupBuildDefinition( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkModifyGroupBuildDefinitionAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_GROUP_BUILD_DEFINITION_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_GROUP_BUILD_DEFINITION_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_MODIFY_GROUP_BUILD_DEFINITION_OPERATION, resource );
}
/**
@@ -655,497 +280,148 @@
* project
*
* @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedAddProjectBuildDefinition( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkAddProjectBuildDefinitionAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_BUILD_DEFINTION_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_BUILD_DEFINTION_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_BUILD_DEFINTION_OPERATION, resource );
}
/**
* Check if the current user is authorized to modify a build definition of a specific project
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedModifyProjectBuildDefinition( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkModifyProjectBuildDefinitionAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_BUILD_DEFINITION_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_BUILD_DEFINITION_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_BUILD_DEFINITION_OPERATION, resource );
}
/**
* Check if the current user is authorized to delete a build definition of a specific
* project
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedRemoveProjectBuildDefinition( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkRemoveProjectBuildDefinitionAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_BUILD_DEFINITION_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_BUILD_DEFINITION_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_BUILD_DEFINITION_OPERATION, resource );
}
/**
* Check if the current user is authorized to add a notifier to the specified
* project group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedAddProjectGroupNotifier( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkAddProjectGroupNotifierAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_GROUP_NOTIFIER_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_GROUP_NOTIFIER_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_GROUP_NOTIFIER_OPERATION, resource );
}
/**
* Check if the current user is authorized to delete a notifier in the specified
* project group
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedRemoveProjectGroupNotifier( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkRemoveProjectGroupNotifierAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_NOTIFIER_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_NOTIFIER_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_REMOVE_GROUP_NOTIFIER_OPERATION, resource );
}
/**
* Check if the current user is authorized to modify a notifier in the specified
* project group
*
- * @param resource the operartion resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operartion resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedModifyProjectGroupNotifier( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkModifyProjectGroupNotifierAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_GROUP_NOTIFIER_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_GROUP_NOTIFIER_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_MODIFY_GROUP_NOTIFIER_OPERATION, resource );
}
/**
* Check if the current user is authorized to add a notifier to a specific project
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedAddProjectNotifier( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkAddProjectNotifierAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_NOTIFIER_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_NOTIFIER_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_NOTIFIER_OPERATION, resource );
}
/**
* Check if the current user is authorized to delete a notifier in a specific project
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedRemoveProjectNotifier( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkRemoveProjectNotifierAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_NOTIFIER_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_NOTIFIER_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_REMOVE_PROJECT_NOTIFIER_OPERATION, resource );
}
/**
* Check if the current user is authorized to modify a notifier in a specific project
*
- * @param resource the operation resource
- * @return
- * @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * @param resource the operation resource
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedModifyProjectNotifier( String resource )
- throws AuthenticationRequiredException, AuthorizationRequiredException
+ protected void checkModifyProjectNotifierAuthorization( String resource )
+ throws AuthorizationRequiredException
{
- if( !isAuthenticated() )
- {
- throw new AuthenticationRequiredException( "Authentication required." );
- }
-
- try
- {
- if ( resource != null && !"".equals( resource.trim() ) )
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_NOTIFIER_OPERATION, resource ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- else
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_NOTIFIER_OPERATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_MODIFY_PROJECT_NOTIFIER_OPERATION, resource );
}
/**
* Check if the current user is authorized to manage the application's configuration
*
- * @return
* @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * if the user isn't authorized if the user isn't authenticated
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedManageConfiguration()
+ protected void checkManageConfigurationAuthorization()
throws AuthenticationRequiredException, AuthorizationRequiredException
{
- if( !isAuthenticated() )
+ if ( !isAuthenticated() )
{
throw new AuthenticationRequiredException( "Authentication required." );
}
- try
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MANAGE_CONFIGURATION ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_CONFIGURATION );
}
/**
* Check if the current user is authorized to manage the project build schedules
*
- * @return
* @throws AuthenticationRequiredException
- * @throws AuthorizationRequiredException
+ * if the user isn't authorized if the user isn't authenticated
+ * @throws AuthorizationRequiredException if the user isn't authorized if the user isn't authorized
*/
- protected boolean isAuthorizedManageSchedules()
+ protected void checkManageSchedulesAuthorization()
throws AuthenticationRequiredException, AuthorizationRequiredException
{
- if( !isAuthenticated() )
+ if ( !isAuthenticated() )
{
throw new AuthenticationRequiredException( "Authentication required." );
}
- try
- {
- if ( !getSecuritySystem().isAuthorized( getSecuritySession(),
- ContinuumRoleConstants.CONTINUUM_MANAGE_SCHEDULES ) )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_AUTHORIZATION_REQUIRED );
- }
- }
- catch ( ComponentLookupException cle )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
- catch ( AuthorizationException ae )
- {
- throw new AuthorizationRequiredException( ERROR_MSG_PROCESSING_AUTHORIZATION );
- }
-
- return true;
+ checkAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_SCHEDULES );
}
/**
@@ -1173,13 +449,10 @@
/**
* Get the security system
*
- * @return
- * @throws ComponentLookupException
+ * @return the security system
*/
private SecuritySystem getSecuritySystem()
- throws ComponentLookupException
{
-
return securitySystem;
}
@@ -1190,8 +463,8 @@
/**
* Check if the current user is already authenticated
- *
- * @return
+ *
+ * @return true if the user is authenticated
*/
public boolean isAuthenticated()
{