* 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;
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;
}
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;
}
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;
}
--- /dev/null
+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";
+}
* 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;
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() )
{
<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>
--- /dev/null
+<%--
+ ~ 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>