diff --git a/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java b/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java index c0f341782..90fd03dea 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/security/PasswordController.java @@ -63,14 +63,16 @@ public class PasswordController { String ownerPassword = request.getOwnerPassword(); String password = request.getPassword(); int keyLength = request.getKeyLength(); - boolean preventAssembly = request.isPreventAssembly(); - boolean preventExtractContent = request.isPreventExtractContent(); - boolean preventExtractForAccessibility = request.isPreventExtractForAccessibility(); - boolean preventFillInForm = request.isPreventFillInForm(); - boolean preventModify = request.isPreventModify(); - boolean preventModifyAnnotations = request.isPreventModifyAnnotations(); - boolean preventPrinting = request.isPreventPrinting(); - boolean preventPrintingFaithful = request.isPreventPrintingFaithful(); + boolean preventAssembly = Boolean.TRUE.equals(request.getPreventAssembly()); + boolean preventExtractContent = Boolean.TRUE.equals(request.getPreventExtractContent()); + boolean preventExtractForAccessibility = + Boolean.TRUE.equals(request.getPreventExtractForAccessibility()); + boolean preventFillInForm = Boolean.TRUE.equals(request.getPreventFillInForm()); + boolean preventModify = Boolean.TRUE.equals(request.getPreventModify()); + boolean preventModifyAnnotations = + Boolean.TRUE.equals(request.getPreventModifyAnnotations()); + boolean preventPrinting = Boolean.TRUE.equals(request.getPreventPrinting()); + boolean preventPrintingFaithful = Boolean.TRUE.equals(request.getPreventPrintingFaithful()); PDDocument document = pdfDocumentFactory.load(fileInput); AccessPermission ap = new AccessPermission(); diff --git a/src/main/java/stirling/software/SPDF/model/api/security/AddPasswordRequest.java b/src/main/java/stirling/software/SPDF/model/api/security/AddPasswordRequest.java index 6769a20cb..8dfa4e54f 100644 --- a/src/main/java/stirling/software/SPDF/model/api/security/AddPasswordRequest.java +++ b/src/main/java/stirling/software/SPDF/model/api/security/AddPasswordRequest.java @@ -32,29 +32,31 @@ public class AddPasswordRequest extends PDFFile { requiredMode = Schema.RequiredMode.REQUIRED) private int keyLength = 256; - @Schema(description = "Whether document assembly is prevented", example = "false") - private boolean preventAssembly; + @Schema(description = "Whether document assembly is prevented", defaultValue = "false") + private Boolean preventAssembly; - @Schema(description = "Whether content extraction is prevented", example = "false") - private boolean preventExtractContent; + @Schema(description = "Whether content extraction is prevented", defaultValue = "false") + private Boolean preventExtractContent; @Schema( description = "Whether content extraction for accessibility is prevented", - example = "false") - private boolean preventExtractForAccessibility; + defaultValue = "false") + private Boolean preventExtractForAccessibility; - @Schema(description = "Whether form filling is prevented", example = "false") - private boolean preventFillInForm; + @Schema(description = "Whether form filling is prevented", defaultValue = "false") + private Boolean preventFillInForm; - @Schema(description = "Whether document modification is prevented", example = "false") - private boolean preventModify; + @Schema(description = "Whether document modification is prevented", defaultValue = "false") + private Boolean preventModify; - @Schema(description = "Whether modification of annotations is prevented", example = "false") - private boolean preventModifyAnnotations; + @Schema( + description = "Whether modification of annotations is prevented", + defaultValue = "false") + private Boolean preventModifyAnnotations; - @Schema(description = "Whether printing of the document is prevented", example = "false") - private boolean preventPrinting; + @Schema(description = "Whether printing of the document is prevented", defaultValue = "false") + private Boolean preventPrinting; - @Schema(description = "Whether faithful printing is prevented", example = "false") - private boolean preventPrintingFaithful; + @Schema(description = "Whether faithful printing is prevented", defaultValue = "false") + private Boolean preventPrintingFaithful; }