continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r698817 - /continuum/branches/continuum-1.2.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
Date Thu, 25 Sep 2008 04:56:16 GMT
Author: evenisse
Date: Wed Sep 24 21:56:16 2008
New Revision: 698817

URL: http://svn.apache.org/viewvc?rev=698817&view=rev
Log:
[CONTINUUM-1889] Don't show project groups if the user isn't authorized to add a project in
them

Modified:
    continuum/branches/continuum-1.2.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java

Modified: continuum/branches/continuum-1.2.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.2.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=698817&r1=698816&r2=698817&view=diff
==============================================================================
--- continuum/branches/continuum-1.2.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
(original)
+++ continuum/branches/continuum-1.2.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
Wed Sep 24 21:56:16 2008
@@ -28,7 +28,6 @@
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.web.bean.ProjectGroupUserBean;
-import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
 import org.codehaus.plexus.redback.rbac.RBACManager;
 import org.codehaus.plexus.redback.rbac.RbacManagerException;
@@ -346,7 +345,10 @@
         while ( proj_group.hasNext() )
         {
             ProjectGroup pg = (ProjectGroup) proj_group.next();
-            projectGroups.put( new Integer( pg.getId() ), pg.getName() );
+            if ( isAuthorized( projectGroup.getName() ) )
+            {
+                projectGroups.put( new Integer( pg.getId() ), pg.getName() );
+            }
         }
 
         if ( projectGroup.getLocalRepository() != null )
@@ -973,4 +975,17 @@
     {
         this.disabledRepositories = disabledRepositories;
     }
+
+    private boolean isAuthorized( String projectGroupName )
+    {
+        try
+        {
+            checkAddProjectToGroupAuthorization( projectGroupName );
+            return true;
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            return false;
+        }
+    }
 }



Mime
View raw message