mirror of https://github.com/apache/archiva.git
Adding "You have access to no repositories" screen.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-backend-security@592186 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c6bf224e8b
commit
e65732f69b
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
}
|
|
@ -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() )
|
||||
{
|
||||
|
|
|
@ -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">
|
||||
|
@ -126,6 +127,7 @@
|
|||
<!-- 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>
|
||||
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue