001package org.apache.archiva.security; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.archiva.admin.model.beans.ManagedRepository; 023 024import java.util.List; 025 026/** 027 * UserRepositories 028 * 029 * 030 */ 031public interface UserRepositories 032{ 033 /** 034 * Get the list of observable repository ids for the user specified. 035 * 036 * @param principal the principle to obtain the observable repository ids from. 037 * @return the list of observable repository ids. 038 * @throws PrincipalNotFoundException 039 * @throws AccessDeniedException 040 * @throws ArchivaSecurityException 041 */ 042 List<String> getObservableRepositoryIds( String principal ) 043 throws PrincipalNotFoundException, AccessDeniedException, ArchivaSecurityException; 044 045 /** 046 * Get the list of writable repository ids for the user specified. 047 * 048 * @param principal the principle to obtain the observable repository ids from. 049 * @return the list of observable repository ids. 050 * @throws PrincipalNotFoundException 051 * @throws AccessDeniedException 052 * @throws ArchivaSecurityException 053 */ 054 List<String> getManagableRepositoryIds( String principal ) 055 throws PrincipalNotFoundException, AccessDeniedException, ArchivaSecurityException; 056 057 /** 058 * Create any missing repository roles for the provided repository id. 059 * 060 * @param repoId the repository id to work off of. 061 * @throws ArchivaSecurityException if there was a problem creating the repository roles. 062 */ 063 void createMissingRepositoryRoles( String repoId ) 064 throws ArchivaSecurityException; 065 066 /** 067 * Check if user is authorized to upload artifacts in the repository. 068 * 069 * @param principal 070 * @param repoId 071 * @return 072 * @throws PrincipalNotFoundException 073 * @throws ArchivaSecurityException 074 */ 075 boolean isAuthorizedToUploadArtifacts( String principal, String repoId) 076 throws PrincipalNotFoundException, ArchivaSecurityException; 077 078 /** 079 * Check if user is authorized to delete artifacts in the repository. 080 * 081 * @param principal 082 * @param repoId 083 * @return 084 * @throws ArchivaSecurityException 085 * @throws AccessDeniedException 086 */ 087 boolean isAuthorizedToDeleteArtifacts( String principal, String repoId ) 088 throws AccessDeniedException, ArchivaSecurityException; 089 090 /** 091 * 092 * @param principal 093 * @since 1.4-M3 094 * @return 095 * @throws ArchivaSecurityException 096 * @throws AccessDeniedException 097 * @throws PrincipalNotFoundException 098 */ 099 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}