This project has retired. For details please refer to its Attic page.
UserRepositories xref
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.List;
25  
26  /**
27   * UserRepositories 
28   *
29   *
30   */
31  public interface UserRepositories
32  {
33      /**
34       * Get the list of observable repository ids for the user specified.
35       * 
36       * @param principal the principle to obtain the observable repository ids from.
37       * @return the list of observable repository ids.
38       * @throws PrincipalNotFoundException
39       * @throws AccessDeniedException
40       * @throws ArchivaSecurityException
41       */
42      List<String> getObservableRepositoryIds( String principal )
43          throws PrincipalNotFoundException, AccessDeniedException, ArchivaSecurityException;
44      
45      /**
46       * Get the list of writable repository ids for the user specified.
47       * 
48       * @param principal the principle to obtain the observable repository ids from.
49       * @return the list of observable repository ids.
50       * @throws PrincipalNotFoundException
51       * @throws AccessDeniedException
52       * @throws ArchivaSecurityException
53       */
54      List<String> getManagableRepositoryIds( String principal )
55          throws PrincipalNotFoundException, AccessDeniedException, ArchivaSecurityException;
56      
57      /**
58       * Create any missing repository roles for the provided repository id.
59       * 
60       * @param repoId the repository id to work off of.
61       * @throws ArchivaSecurityException if there was a problem creating the repository roles.
62       */
63      void createMissingRepositoryRoles( String repoId )
64          throws ArchivaSecurityException;
65      
66      /**
67       * Check if user is authorized to upload artifacts in the repository.
68       * 
69       * @param principal
70       * @param repoId
71       * @return
72       * @throws PrincipalNotFoundException
73       * @throws ArchivaSecurityException
74       */
75      boolean isAuthorizedToUploadArtifacts( String principal, String repoId)
76          throws PrincipalNotFoundException, ArchivaSecurityException;
77       
78      /**
79       * Check if user is authorized to delete artifacts in the repository.
80       * 
81       * @param principal
82       * @param repoId
83       * @return
84       * @throws ArchivaSecurityException 
85       * @throws AccessDeniedException 
86       */
87      boolean isAuthorizedToDeleteArtifacts( String principal, String repoId )
88          throws AccessDeniedException, ArchivaSecurityException;
89  
90      /**
91       *
92       * @param principal
93       * @since 1.4-M3
94       * @return
95       * @throws ArchivaSecurityException
96       * @throws AccessDeniedException
97       * @throws PrincipalNotFoundException
98       */
99      List<ManagedRepository> getAccessibleRepositories( String principal )
100             throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException;
101 
102     /**
103      *
104      * Returns a list of repositories for which the user has the manager role.
105      *
106      * @param principal
107      * @since 2.2.2
108      * @return
109      * @throws ArchivaSecurityException
110      * @throws AccessDeniedException
111      * @throws PrincipalNotFoundException
112      */
113     List<ManagedRepository> getManagableRepositories( String principal )
114             throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException;
115     
116 }