Interface ReadOnlyCheck

All Known Subinterfaces:
RepositoryArchivedCheck, RepositoryExportingCheck
All Known Implementing Classes:
DefaultRepositoryExportingCheck, EventDrivenRepositoryArchiveCheck

@ExtensionPoint public interface ReadOnlyCheck
Read only check could be used to mark a repository as read only.
Since:
2.19.0
  • Method Details

    • getReason

      String getReason()
      Returns the reason for the write protection.
    • isReadOnly

      default boolean isReadOnly(String repositoryId)
      Returns true if the repository with the given id is read only. If this is the case, all permissions not marked "read only" will be denied fot this repository, stores for this repository cannot be written, and calling modifying commands will be prevented. If only special permissions should be forbidden without blocking stores and commands, use isForbidden(String, String) instead.
      Parameters:
      repositoryId - repository id
      Returns:
      true if repository is read only
      See Also:
    • isReadOnly

      default boolean isReadOnly(Repository repository)
      Returns true if the repository is read only. By default forwards to isReadOnly(String) with the id of the given repository.
      Parameters:
      repository - The repository to check for.
      Returns:
      true if repository is read only
      See Also:
    • check

      default void check(Repository repository)
      Throws a ReadOnlyException if the repository is read only.
      Parameters:
      repository - The repository to check for.
    • check

      default void check(String repositoryId)
      Throws a ReadOnlyException if the repository with th id is read only.
      Parameters:
      repositoryId - The id of the repository to check for.
    • isForbidden

      default boolean isForbidden(String permission, String repositoryId)
      By default returns isReadOnly(String). This is meant to be overridden if only specific permissions should be blocked. In contrast to isReadOnly(String), writing to stores or calling modifying commands will not be prevented, so this relies on permission checks only.
      Parameters:
      permission - The permission to check.
      repositoryId - The id of the repository to check for.
      Returns:
      true if this permission should be forbidden for the current repository regardless of the current user.
    • isReadOnly

      @Deprecated default boolean isReadOnly(String permission, String repositoryId)
      Deprecated.
      This method is named badly. Please use isForbidden(String, String) instead. This implementation simply delegates to this method.