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/05/14 21:44:49 UTC
svn commit: r537959 -
/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Author: evenisse
Date: Mon May 14 12:44:47 2007
New Revision: 537959
URL: http://svn.apache.org/viewvc?view=rev&rev=537959
Log:
[CONTINUUM-684] Add security to xmlrpc
Modified:
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?view=diff&rev=537959&r1=537958&r2=537959
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java Mon May 14 12:44:47 2007
@@ -112,18 +112,26 @@
// Projects Groups
// ----------------------------------------------------------------------
- public String getProjectGroupName( int projectGroupId )
+ protected String getProjectGroupName( int projectGroupId )
throws ContinuumException
{
- checkViewProjectGroupAuthorization( getProjectGroupName( projectGroupId ) );
-
- ProjectGroupSummary pgs = getProjectGroupSummary( projectGroupId );
+ ProjectGroupSummary pgs = getPGSummary( projectGroupId );
return pgs.getName();
}
+ private ProjectGroupSummary getPGSummary( int projectGroupId )
+ throws ContinuumException
+ {
+ org.apache.maven.continuum.model.project.ProjectGroup projectGroup =
+ continuum.getProjectGroup( projectGroupId );
+ return populateProjectGroupSummary( projectGroup );
+ }
+
public ProjectGroupSummary getProjectGroupSummary( int projectGroupId )
throws ContinuumException
{
+ checkViewProjectGroupAuthorization( getProjectGroupName( projectGroupId ) );
+
org.apache.maven.continuum.model.project.ProjectGroup projectGroup =
continuum.getProjectGroup( projectGroupId );
return populateProjectGroupSummary( projectGroup );
@@ -132,6 +140,8 @@
public ProjectGroup getProjectGroupWithProjects( int projectGroupId )
throws ContinuumException
{
+ checkViewProjectGroupAuthorization( getProjectGroupName( projectGroupId ) );
+
org.apache.maven.continuum.model.project.ProjectGroup projectGroup =
continuum.getProjectGroupWithProjects( projectGroupId );
return populateProjectGroupWithProjects( projectGroup );
@@ -140,6 +150,8 @@
public int removeProjectGroup( int projectGroupId )
throws ContinuumException
{
+ checkRemoveProjectGroupAuthorization( getProjectGroupName( projectGroupId ) );
+
continuum.removeProjectGroup( projectGroupId );
return 0;
}
@@ -151,6 +163,9 @@
public int addProjectToBuildQueue( int projectId )
throws ContinuumException
{
+ ProjectSummary ps = getProjectSummary( projectId );
+ checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
+
continuum.buildProject( projectId, ContinuumProjectState.TRIGGER_SCHEDULED );
return 0;
}
@@ -158,6 +173,9 @@
public int addProjectToBuildQueue( int projectId, int buildDefinitionId )
throws ContinuumException
{
+ ProjectSummary ps = getProjectSummary( projectId );
+ checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
+
continuum.buildProject( projectId, buildDefinitionId, ContinuumProjectState.TRIGGER_SCHEDULED );
return 0;
}
@@ -165,6 +183,9 @@
public int buildProject( int projectId )
throws ContinuumException
{
+ ProjectSummary ps = getProjectSummary( projectId );
+ checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
+
continuum.buildProject( projectId );
return 0;
}
@@ -172,6 +193,9 @@
public int buildProject( int projectId, int buildDefintionId )
throws ContinuumException
{
+ ProjectSummary ps = getProjectSummary( projectId );
+ checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
+
continuum.buildProject( projectId, buildDefintionId );
return 0;
}
@@ -183,12 +207,18 @@
public BuildResult getBuildResult( int projectId, int buildId )
throws ContinuumException
{
+ ProjectSummary ps = getProjectSummary( projectId );
+ checkViewProjectGroupAuthorization( ps.getProjectGroup().getName() );
+
return populateBuildResult( continuum.getBuildResult( buildId ) );
}
public List getBuildResultsForProject( int projectId )
throws ContinuumException
{
+ ProjectSummary ps = getProjectSummary( projectId );
+ checkViewProjectGroupAuthorization( ps.getProjectGroup().getName() );
+
List result = new ArrayList();
Collection buildResults = continuum.getBuildResultsForProject( projectId );
if ( buildResults != null )
@@ -208,6 +238,9 @@
public String getBuildOutput( int projectId, int buildId )
throws ContinuumException
{
+ ProjectSummary ps = getProjectSummary( projectId );
+ checkViewProjectGroupAuthorization( ps.getProjectGroup().getName() );
+
return continuum.getBuildOutput( projectId, buildId );
}
@@ -240,6 +273,8 @@
public AddingResult addMavenOneProject( String url )
throws ContinuumException
{
+ checkAddProjectGroupAuthorization();
+
ContinuumProjectBuildingResult result = continuum.addMavenOneProject( url );
return populateAddingResult( result );
}
@@ -247,6 +282,8 @@
public AddingResult addMavenOneProject( String url, int projectGroupId )
throws ContinuumException
{
+ checkAddProjectToGroupAuthorization( getProjectGroupName( projectGroupId ) );
+
ContinuumProjectBuildingResult result = continuum.addMavenOneProject( url, projectGroupId );
return populateAddingResult( result );
}
@@ -258,6 +295,8 @@
public ProjectSummary addAntProject( ProjectSummary project )
throws ContinuumException
{
+ checkAddProjectGroupAuthorization();
+
int projectId = continuum.addProject( populateProject( project ), "ant" );
return getProjectSummary( projectId );
}
@@ -269,6 +308,8 @@
public ProjectSummary addShellProject( ProjectSummary project )
throws ContinuumException
{
+ checkAddProjectGroupAuthorization();
+
int projectId = continuum.addProject( populateProject( project ), "shell" );
return getProjectSummary( projectId );
}