mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-12 17:52:13 +02:00
Fixed logically inverted API and inconsistent naming scheme in permission settings
This commit is contained in:
parent
d95f169ebd
commit
057f7891ca
@ -63,25 +63,25 @@ public class PasswordController {
|
|||||||
String ownerPassword = request.getOwnerPassword();
|
String ownerPassword = request.getOwnerPassword();
|
||||||
String password = request.getPassword();
|
String password = request.getPassword();
|
||||||
int keyLength = request.getKeyLength();
|
int keyLength = request.getKeyLength();
|
||||||
boolean canAssembleDocument = request.isCanAssembleDocument();
|
boolean preventAssembly = request.isPreventAssembly();
|
||||||
boolean canExtractContent = request.isCanExtractContent();
|
boolean preventExtractContent = request.isPreventExtractContent();
|
||||||
boolean canExtractForAccessibility = request.isCanExtractForAccessibility();
|
boolean preventExtractForAccessibility = request.isPreventExtractForAccessibility();
|
||||||
boolean canFillInForm = request.isCanFillInForm();
|
boolean preventFillInForm = request.isPreventFillInForm();
|
||||||
boolean canModify = request.isCanModify();
|
boolean preventModify = request.isPreventModify();
|
||||||
boolean canModifyAnnotations = request.isCanModifyAnnotations();
|
boolean preventModifyAnnotations = request.isPreventModifyAnnotations();
|
||||||
boolean canPrint = request.isCanPrint();
|
boolean preventPrinting = request.isPreventPrinting();
|
||||||
boolean canPrintFaithful = request.isCanPrintFaithful();
|
boolean preventPrintingFaithful = request.isPreventPrintingFaithful();
|
||||||
|
|
||||||
PDDocument document = pdfDocumentFactory.load(fileInput);
|
PDDocument document = pdfDocumentFactory.load(fileInput);
|
||||||
AccessPermission ap = new AccessPermission();
|
AccessPermission ap = new AccessPermission();
|
||||||
ap.setCanAssembleDocument(!canAssembleDocument);
|
ap.setCanAssembleDocument(!preventAssembly);
|
||||||
ap.setCanExtractContent(!canExtractContent);
|
ap.setCanExtractContent(!preventExtractContent);
|
||||||
ap.setCanExtractForAccessibility(!canExtractForAccessibility);
|
ap.setCanExtractForAccessibility(!preventExtractForAccessibility);
|
||||||
ap.setCanFillInForm(!canFillInForm);
|
ap.setCanFillInForm(!preventFillInForm);
|
||||||
ap.setCanModify(!canModify);
|
ap.setCanModify(!preventModify);
|
||||||
ap.setCanModifyAnnotations(!canModifyAnnotations);
|
ap.setCanModifyAnnotations(!preventModifyAnnotations);
|
||||||
ap.setCanPrint(!canPrint);
|
ap.setCanPrint(!preventPrinting);
|
||||||
ap.setCanPrintFaithful(!canPrintFaithful);
|
ap.setCanPrintFaithful(!preventPrintingFaithful);
|
||||||
StandardProtectionPolicy spp = new StandardProtectionPolicy(ownerPassword, password, ap);
|
StandardProtectionPolicy spp = new StandardProtectionPolicy(ownerPassword, password, ap);
|
||||||
|
|
||||||
if (!"".equals(ownerPassword) || !"".equals(password)) {
|
if (!"".equals(ownerPassword) || !"".equals(password)) {
|
||||||
|
@ -29,31 +29,29 @@ public class AddPasswordRequest extends PDFFile {
|
|||||||
defaultValue = "256")
|
defaultValue = "256")
|
||||||
private int keyLength = 256;
|
private int keyLength = 256;
|
||||||
|
|
||||||
@Schema(description = "Whether the document assembly is allowed", example = "false")
|
@Schema(description = "Whether document assembly is prevented", example = "false")
|
||||||
private boolean canAssembleDocument;
|
private boolean preventAssembly;
|
||||||
|
|
||||||
|
@Schema(description = "Whether content extraction is prevented", example = "false")
|
||||||
|
private boolean preventExtractContent;
|
||||||
|
|
||||||
@Schema(
|
@Schema(
|
||||||
description = "Whether content extraction for accessibility is allowed",
|
description = "Whether content extraction for accessibility is prevented",
|
||||||
example = "false")
|
example = "false")
|
||||||
private boolean canExtractContent;
|
private boolean preventExtractForAccessibility;
|
||||||
|
|
||||||
@Schema(
|
@Schema(description = "Whether form filling is prevented", example = "false")
|
||||||
description = "Whether content extraction for accessibility is allowed",
|
private boolean preventFillInForm;
|
||||||
example = "false")
|
|
||||||
private boolean canExtractForAccessibility;
|
|
||||||
|
|
||||||
@Schema(description = "Whether form filling is allowed", example = "false")
|
@Schema(description = "Whether document modification is prevented", example = "false")
|
||||||
private boolean canFillInForm;
|
private boolean preventModify;
|
||||||
|
|
||||||
@Schema(description = "Whether the document modification is allowed", example = "false")
|
@Schema(description = "Whether modification of annotations is prevented", example = "false")
|
||||||
private boolean canModify;
|
private boolean preventModifyAnnotations;
|
||||||
|
|
||||||
@Schema(description = "Whether modification of annotations is allowed", example = "false")
|
@Schema(description = "Whether printing of the document is prevented", example = "false")
|
||||||
private boolean canModifyAnnotations;
|
private boolean preventPrinting;
|
||||||
|
|
||||||
@Schema(description = "Whether printing of the document is allowed", example = "false")
|
@Schema(description = "Whether faithful printing is prevented", example = "false")
|
||||||
private boolean canPrint;
|
private boolean preventPrintingFaithful;
|
||||||
|
|
||||||
@Schema(description = "Whether faithful printing is allowed", example = "false")
|
|
||||||
private boolean canPrintFaithful;
|
|
||||||
}
|
}
|
||||||
|
@ -41,36 +41,36 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="mb-2" th:text="#{addPassword.selectText.5}"></label>
|
<label class="mb-2" th:text="#{addPassword.selectText.5}"></label>
|
||||||
<div class="form-check ms-3">
|
<div class="form-check ms-3">
|
||||||
<input type="checkbox" id="canAssembleDocument" name="canAssembleDocument">
|
<input type="checkbox" id="preventAssembly" name="preventAssembly">
|
||||||
<label for="canAssembleDocument" th:text="#{addPassword.selectText.6}"></label>
|
<label for="preventAssembly" th:text="#{addPassword.selectText.6}"></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check ms-3">
|
<div class="form-check ms-3">
|
||||||
<input type="checkbox" id="canExtractContent" name="canExtractContent">
|
<input type="checkbox" id="preventExtractContent" name="preventExtractContent">
|
||||||
<label for="canExtractContent" th:text="#{addPassword.selectText.7}"></label>
|
<label for="preventExtractContent" th:text="#{addPassword.selectText.7}"></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check ms-3">
|
<div class="form-check ms-3">
|
||||||
<input type="checkbox" id="canExtractForAccessibility" name="canExtractForAccessibility">
|
<input type="checkbox" id="preventExtractForAccessibility" name="preventExtractForAccessibility">
|
||||||
<label for="canExtractForAccessibility" th:text="#{addPassword.selectText.8}"></label>
|
<label for="preventExtractForAccessibility" th:text="#{addPassword.selectText.8}"></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check ms-3">
|
<div class="form-check ms-3">
|
||||||
<input type="checkbox" id="canFillInForm" name="canFillInForm">
|
<input type="checkbox" id="preventFillInForm" name="preventFillInForm">
|
||||||
<label for="canFillInForm" th:text="#{addPassword.selectText.9}"></label>
|
<label for="preventFillInForm" th:text="#{addPassword.selectText.9}"></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check ms-3">
|
<div class="form-check ms-3">
|
||||||
<input type="checkbox" id="canModify" name="canModify">
|
<input type="checkbox" id="preventModify" name="preventModify">
|
||||||
<label for="canModify" th:text="#{addPassword.selectText.10}"></label>
|
<label for="preventModify" th:text="#{addPassword.selectText.10}"></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check ms-3">
|
<div class="form-check ms-3">
|
||||||
<input type="checkbox" id="canModifyAnnotations" name="canModifyAnnotations">
|
<input type="checkbox" id="preventModifyAnnotations" name="preventModifyAnnotations">
|
||||||
<label for="canModifyAnnotations" th:text="#{addPassword.selectText.11}"></label>
|
<label for="preventModifyAnnotations" th:text="#{addPassword.selectText.11}"></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check ms-3">
|
<div class="form-check ms-3">
|
||||||
<input type="checkbox" id="canPrint" name="canPrint">
|
<input type="checkbox" id="preventPrinting" name="preventPrinting">
|
||||||
<label for="canPrint" th:text="#{addPassword.selectText.12}"></label>
|
<label for="preventPrinting" th:text="#{addPassword.selectText.12}"></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check ms-3">
|
<div class="form-check ms-3">
|
||||||
<input type="checkbox" id="canPrintFaithful" name="canPrintFaithful">
|
<input type="checkbox" id="preventPrintingFaithful" name="preventPrintingFaithful">
|
||||||
<label for="canPrintFaithful" th:text="#{addPassword.selectText.13}"></label>
|
<label for="preventPrintingFaithful" th:text="#{addPassword.selectText.13}"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
Loading…
Reference in New Issue
Block a user