]> source.dussan.org Git - archiva.git/commitdiff
Adding "You have access to no repositories" screen. archiva-backend-security@642424
authorJoakim Erdfelt <joakime@apache.org>
Mon, 5 Nov 2007 23:41:29 +0000 (23:41 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Mon, 5 Nov 2007 23:41:29 +0000 (23:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-backend-security@592186 13f79535-47bb-0310-9956-ffa450edef68

archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/GlobalResults.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
archiva-web/archiva-webapp/src/main/resources/xwork.xml
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/accessToNoRepos.jsp [new file with mode: 0644]

index 91993e67e5800e817e395437c309c3db4fe3eab3..2bc0422314906274cd69d5e0c0131d6e3dae998e 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.web.action;
  * under the License.
  */
 
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.database.browsing.BrowsingResults;
 import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
@@ -66,7 +67,13 @@ public class BrowseAction
 
     public String browse()
     {
-        this.results = repoBrowsing.getRoot( getPrincipal(), getObservableRepos() );
+        List<String> selectedRepos = getObservableRepos();
+        if ( CollectionUtils.isEmpty( selectedRepos ) )
+        {
+            return GlobalResults.ACCESS_TO_NO_REPOS;
+        }
+
+        this.results = repoBrowsing.getRoot( getPrincipal(), selectedRepos );
         return SUCCESS;
     }
 
@@ -79,7 +86,14 @@ public class BrowseAction
             return ERROR;
         }
 
-        this.results = repoBrowsing.selectGroupId( getPrincipal(), getObservableRepos(), groupId );
+        List<String> selectedRepos = getObservableRepos();
+        if ( CollectionUtils.isEmpty( selectedRepos ) )
+        {
+            return GlobalResults.ACCESS_TO_NO_REPOS;
+        }
+
+        
+        this.results = repoBrowsing.selectGroupId( getPrincipal(), selectedRepos, groupId );
         return SUCCESS;
     }
 
@@ -99,7 +113,14 @@ public class BrowseAction
             return ERROR;
         }
 
-        this.results = repoBrowsing.selectArtifactId( getPrincipal(), getObservableRepos(), groupId, artifactId );
+        List<String> selectedRepos = getObservableRepos();
+        if ( CollectionUtils.isEmpty( selectedRepos ) )
+        {
+            return GlobalResults.ACCESS_TO_NO_REPOS;
+        }
+
+        
+        this.results = repoBrowsing.selectArtifactId( getPrincipal(), selectedRepos, groupId, artifactId );
         return SUCCESS;
     }
     
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/GlobalResults.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/GlobalResults.java
new file mode 100644 (file)
index 0000000..15b7ae5
--- /dev/null
@@ -0,0 +1,31 @@
+package org.apache.maven.archiva.web.action;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * GlobalResults - constants for global result definitions. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class GlobalResults
+{
+    public static final String ACCESS_TO_NO_REPOS = "access_to_no_repos";
+}
index d81d03e340b08ce972cef412bd13fd78bb6412b0..2785f7414eca76165df58aac4aa69924f3f9164f 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.web.action;
  * under the License.
  */
 
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.database.Constraint;
@@ -95,8 +96,14 @@ public class SearchAction
         assert q != null && q.length() != 0;
 
         SearchResultLimits limits = new SearchResultLimits( 0 );
+        
+        List<String> selectedRepos = getObservableRepos();
+        if ( CollectionUtils.isEmpty( selectedRepos ) )
+        {
+            return GlobalResults.ACCESS_TO_NO_REPOS;
+        }
 
-        results = crossRepoSearch.searchForTerm( getPrincipal(), getObservableRepos(), q, limits );
+        results = crossRepoSearch.searchForTerm( getPrincipal(), selectedRepos, q, limits );
 
         if ( results.isEmpty() )
         {
index 4966cbde7bab6aa58c59683b41c389cca826a489..6727e5769f9462bb0993e2729c3b5c5ea0afd0fd 100644 (file)
@@ -82,6 +82,7 @@
 
     <global-results>
       <!-- The following security-* result names arrive from the plexus-security package -->
+      
       <result name="security-login-success" type="redirect-action">index</result>
       <result name="security-login-cancel" type="redirect-action">index</result>
       <result name="security-login-locked" type="redirect-action">
       <!-- Generic Catchall for those action configurations that forget to
            include a result for 'error' -->
       <result name="error">/WEB-INF/jsp/generalError.jsp</result>
+      <result name="access_to_no_repos">/WEB-INF/jsp/accessToNoRepos.jsp</result>
     </global-results>
   </package>
 
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/accessToNoRepos.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/accessToNoRepos.jsp
new file mode 100644 (file)
index 0000000..5ed0473
--- /dev/null
@@ -0,0 +1,46 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<html>
+<head>
+  <title>You have access to no repositories</title>
+  <ww:head/>
+</head>
+
+<body>
+
+<div id="contentArea">
+  
+   <div id="results">
+     You have access to no repositories.  
+     Ask your system administrator for access.  
+   </div>
+  
+</div>
+
+<div class="clear">
+  <hr/>
+</div>
+
+</body>
+
+</html>