Class DeleteDocumentUseCase
java.lang.Object
com.irurueta.authserver.resourceserver.application.documents.DeleteDocumentUseCase
Use case that deletes a document on behalf of a caller. Only the owner of a document, or an administrator, may
delete it. A document the caller may not delete is reported exactly like a missing one, so that the answer never
reveals that a document with that identifier exists and belongs to someone else (the API answers
404 in
both cases rather than 403).-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DocumentRepositoryPort that stores the documents. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
documentRepository
Port that stores the documents.
-
-
Constructor Details
-
DeleteDocumentUseCase
public DeleteDocumentUseCase()
-
-
Method Details
-
execute
Deletes a document when the caller owns it or is an administrator.- Parameters:
id- identifier of the document.caller- subject of the caller.administrator- whether the caller is an administrator, who may delete any document.- Returns:
truewhen the document was deleted,falsewhen it does not exist or the caller may not delete it (the two are deliberately indistinguishable).
-