View Javadoc
1   package org.apache.archiva.security;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.archiva.admin.model.beans.ManagedRepository;
23  
24  import java.util.Collections;
25  import java.util.List;
26  
27  /**
28   * UserRepositories stub used for testing.
29   *
30   *
31   */
32  public class UserRepositoriesStub
33      implements UserRepositories
34  {
35      private List<String> repoIds = Collections.singletonList( "test-repo" );
36  
37      @Override
38      public void createMissingRepositoryRoles( String repoId )
39          throws ArchivaSecurityException
40      {
41      }
42  
43      @Override
44      public List<String> getObservableRepositoryIds( String principal )
45          throws ArchivaSecurityException
46      {
47          return repoIds;
48      }
49  
50      public void setObservableRepositoryIds( List<String> repoIds )
51      {
52          this.repoIds = repoIds;
53      }
54  
55      @Override
56      public boolean isAuthorizedToUploadArtifacts( String principal, String repoId )
57          throws ArchivaSecurityException
58      {
59          return true;
60      }
61  
62      @Override
63      public boolean isAuthorizedToDeleteArtifacts( String principal, String repoId )
64      {
65          return true;
66      }
67  
68      @Override
69      public List<String> getManagableRepositoryIds( String principal )
70          throws ArchivaSecurityException
71      {
72          return null;
73      }
74  
75      public List<String> getRepoIds()
76      {
77          return repoIds;
78      }
79  
80      public void setRepoIds( List<String> repoIds )
81      {
82          this.repoIds = repoIds;
83      }
84  
85      @Override
86      public List<ManagedRepository> getAccessibleRepositories( String principal )
87          throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException
88      {
89          return Collections.emptyList();
90      }
91  
92      @Override
93      public List<ManagedRepository> getManagableRepositories(String principal) throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException {
94          return Collections.emptyList();
95      }
96  }