continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1588418 - /continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Date Fri, 18 Apr 2014 06:07:23 GMT
Author: brett
Date: Fri Apr 18 06:07:23 2014
New Revision: 1588418

URL: http://svn.apache.org/r1588418
Log:
[CONTINUUM-2724] Can't add a project over XMLRPC without a project group

Use a different permission check for this case, since it's about whether a
group can be added, not a project in the given group.

Modified:
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?rev=1588418&r1=1588417&r2=1588418&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Fri Apr 18 06:07:23 2014
@@ -765,7 +765,8 @@ public class ContinuumServiceImpl
 
         buildProjectWithBuildDefinition( projectId, buildDefinitionId,
                                          new org.apache.continuum.utils.build.BuildTrigger(
-                                             ContinuumProjectState.TRIGGER_SCHEDULED, ""
) );
+                                             ContinuumProjectState.TRIGGER_SCHEDULED, ""
)
+        );
         return 0;
     }
 
@@ -813,7 +814,8 @@ public class ContinuumServiceImpl
 
         continuum.buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId,
                                                         new org.apache.continuum.utils.build.BuildTrigger(
-                                                            ContinuumProjectState.TRIGGER_SCHEDULED,
"" ) );
+                                                            ContinuumProjectState.TRIGGER_SCHEDULED,
"" )
+        );
 
         return 0;
     }
@@ -935,7 +937,7 @@ public class ContinuumServiceImpl
     public AddingResult addMavenTwoProject( String url, int projectGroupId )
         throws ContinuumException
     {
-        checkAddProjectToGroupAuthorization( getProjectGroupName( projectGroupId ) );
+        checkAddProjectAuthorization( projectGroupId );
 
         ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url, projectGroupId
);
         return populateAddingResult( result );
@@ -944,7 +946,7 @@ public class ContinuumServiceImpl
     public AddingResult addMavenTwoProject( String url, int projectGroupId, boolean checkoutInSingleDirectory
)
         throws ContinuumException
     {
-        checkAddProjectToGroupAuthorization( getProjectGroupName( projectGroupId ) );
+        checkAddProjectAuthorization( projectGroupId );
 
         ContinuumProjectBuildingResult result;
         try
@@ -966,7 +968,7 @@ public class ContinuumServiceImpl
     public AddingResult addMavenTwoProjectAsSingleProject( String url, int projectGroupId
)
         throws Exception
     {
-        checkAddProjectToGroupAuthorization( getProjectGroupName( projectGroupId ) );
+        checkAddProjectAuthorization( projectGroupId );
 
         ContinuumProjectBuildingResult result;
         try
@@ -989,12 +991,26 @@ public class ContinuumServiceImpl
         return populateAddingResult( result );
     }
 
+    private void checkAddProjectAuthorization( int projectGroupId )
+        throws ContinuumException
+    {
+        if ( projectGroupId == -1 )
+        {
+            checkAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_GROUP_OPERATION );
+        }
+        else
+        {
+            checkAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_PROJECT_TO_GROUP_OPERATION,
getProjectGroupName(
+                projectGroupId ) );
+        }
+    }
+
     public AddingResult addMavenTwoProject( String url, int projectGroupId, boolean checkProtocol,
                                             boolean useCredentialsCache, boolean recursiveProjects,
                                             boolean checkoutInSingleDirectory )
         throws Exception
     {
-        checkAddProjectToGroupAuthorization( getProjectGroupName( projectGroupId ) );
+        checkAddProjectAuthorization( projectGroupId );
 
         ContinuumProjectBuildingResult result;
         try
@@ -1019,7 +1035,7 @@ public class ContinuumServiceImpl
     public AddingResult addMavenOneProject( String url, int projectGroupId )
         throws ContinuumException
     {
-        checkAddProjectToGroupAuthorization( getProjectGroupName( projectGroupId ) );
+        checkAddProjectAuthorization( projectGroupId );
 
         ContinuumProjectBuildingResult result = continuum.addMavenOneProject( url, projectGroupId
);
         return populateAddingResult( result );
@@ -1648,7 +1664,8 @@ public class ContinuumServiceImpl
                 new org.apache.continuum.model.repository.RepositoryPurgeConfiguration();
             return populateRepositoryPurgeConfiguration(
                 continuum.getPurgeConfigurationService().addRepositoryPurgeConfiguration(
-                    populateRepositoryPurgeConfiguration( repoPurge, newPurge ) ) );
+                    populateRepositoryPurgeConfiguration( repoPurge, newPurge ) )
+            );
         }
         catch ( RepositoryServiceException e )
         {
@@ -1744,7 +1761,8 @@ public class ContinuumServiceImpl
                 new org.apache.continuum.model.repository.DirectoryPurgeConfiguration();
             return populateDirectoryPurgeConfiguration(
                 continuum.getPurgeConfigurationService().addDirectoryPurgeConfiguration(
-                    populateDirectoryPurgeConfiguration( dirPurge, newPurge ) ) );
+                    populateDirectoryPurgeConfiguration( dirPurge, newPurge ) )
+            );
         }
         catch ( RepositoryServiceException e )
         {
@@ -2720,7 +2738,8 @@ public class ContinuumServiceImpl
         {
             repoPurge.setRepository( populateLocalRepository( repoPurgeConfig.getRepository(),
                                                               continuum.getRepositoryService().getLocalRepository(
-                                                                  repoPurgeConfig.getRepository().getId()
) ) );
+                                                                  repoPurgeConfig.getRepository().getId()
)
+            ) );
         }
         else
         {
@@ -3342,7 +3361,8 @@ public class ContinuumServiceImpl
         throws Exception
     {
         return serializeObject( this.addBuildDefinitionToProjectGroup( projectGroupId,
-                                                                       (BuildDefinition)
unserializeObject( buildDef ) ) );
+                                                                       (BuildDefinition)
unserializeObject(
+                                                                           buildDef ) ) );
     }
 
     public Map<String, Object> addBuildDefinitionToProjectRPC( int projectId, Map<String,
Object> buildDef )
@@ -3572,7 +3592,8 @@ public class ContinuumServiceImpl
     {
         return serializeObject( this.updateBuildDefinitionForProjectGroup( projectGroupId,
                                                                            (BuildDefinition)
unserializeObject(
-                                                                               buildDef )
) );
+                                                                               buildDef )
+        ) );
     }
 
     public Map<String, Object> updateBuildDefinitionForProjectRPC( int projectId, Map<String,
Object> buildDef )
@@ -3839,7 +3860,8 @@ public class ContinuumServiceImpl
                 releaseProperties.setProperty( "release-by", username );
                 return continuum.getReleaseManager().prepare( project, releaseProperties,
releaseVersions,
                                                               developmentVersions, null,
continuum.getWorkingDirectory(
-                    projectId ).getPath(), environments, executable );
+                        projectId ).getPath(), environments, executable
+                );
             }
         }
         else



Mime
View raw message