Package sonia.scm.repository
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 Summary
Modifier and TypeMethodDescriptiondefault void
Throws aReadOnlyException
if the repository with th id is read only.default void
check
(Repository repository) Throws aReadOnlyException
if the repository is read only.Returns the reason for the write protection.default boolean
isForbidden
(String permission, String repositoryId) By default returnsisReadOnly(String)
.default boolean
isReadOnly
(String repositoryId) Returnstrue
if the repository with the given id is read only.default boolean
isReadOnly
(String permission, String repositoryId) Deprecated.This method is named badly.default boolean
isReadOnly
(Repository repository) Returnstrue
if the repository is read only.
-
Method Details
-
getReason
String getReason()Returns the reason for the write protection. -
isReadOnly
Returnstrue
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, useisForbidden(String, String)
instead.- Parameters:
repositoryId
- repository id- Returns:
true
if repository is read only- See Also:
-
isReadOnly
Returnstrue
if the repository is read only. By default forwards toisReadOnly(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
Throws aReadOnlyException
if the repository is read only.- Parameters:
repository
- The repository to check for.
-
check
Throws aReadOnlyException
if the repository with th id is read only.- Parameters:
repositoryId
- The id of the repository to check for.
-
isForbidden
By default returnsisReadOnly(String)
. This is meant to be overridden if only specific permissions should be blocked. In contrast toisReadOnly(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.This method is named badly. Please useisForbidden(String, String)
instead. This implementation simply delegates to this method.
-