You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserRepositoriesStub.java 2.8KB

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