Skip to content

Commit

Permalink
Merge pull request #481 from EsupPortail/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
dlemaignent authored Jan 23, 2025
2 parents 61cc3dd + 8849bda commit ce28162
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</parent>
<groupId>org.esupportail</groupId>
<artifactId>esup-signature</artifactId>
<version>1.32.1</version>
<version>1.32.2</version>
<name>esup-signature</name>
<properties>
<startClass>org.esupportail.esupsignature.EsupSignatureApplication</startClass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import jakarta.persistence.*;

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

@Entity
Expand Down Expand Up @@ -78,23 +79,23 @@ public void setWorkflows(Set<Workflow> workflows) {
}

public Boolean getCreateSignrequest() {
return createSignrequest;
return Objects.requireNonNullElse(createSignrequest, true);
}

public void setCreateSignrequest(Boolean createSignrequest) {
this.createSignrequest = createSignrequest;
}

public Boolean getReadSignrequest() {
return readSignrequest;
return Objects.requireNonNullElse(readSignrequest, true);
}

public void setReadSignrequest(Boolean readSignrequest) {
this.readSignrequest = readSignrequest;
}

public Boolean getUpdateSignrequest() {
return updateSignrequest;
return Objects.requireNonNullElse(updateSignrequest, true);
}

public void setUpdateSignrequest(Boolean deleteSignrequest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public boolean generateOtpForSignRequest(Long id, Long extUserId, String phone,
User extUser = userService.getById(extUserId);
if(extUser.getUserType().equals(UserType.external) && (!globalProperties.getSmsRequired() || smsService != null)) {
SignBook signBook = signBookRepository.findById(id).get();
if(!signBook.getStatus().equals(SignRequestStatus.pending) && !signBook.getStatus().equals(SignRequestStatus.completed)) {
return false;
}
Otp otp = new Otp();
otp.setCreateDate(new Date());
if(StringUtils.hasText(phone)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,11 @@ export class WorkspacePdf {
} else if(!this.editable) {
this.enableSignMode();
} else {
this.enableReadMode();
if(this.status === 'draft') {
this.enableCommentMode();
} else {
this.enableReadMode();
}
}
this.wheelDetector.addEventListener("down", e => this.pdfViewer.checkCurrentPage(e));
this.wheelDetector.addEventListener("up", e => this.pdfViewer.checkCurrentPage(e));
Expand Down Expand Up @@ -768,6 +772,7 @@ export class WorkspacePdf {
$('#rotateright').prop('disabled', false);
$('#rotateleft').css('opacity', 1);
$('#rotateright').css('opacity', 1);
$('#insert-btn-div').hide();
this.showAllPostits();
$(".sign-space").each(function () {
$(this).hide();
Expand All @@ -793,6 +798,12 @@ export class WorkspacePdf {
$('#signTools').addClass("d-none");
$('#commentsBar').show();
$('#infos').show();
$('#insert-btn-div').show();
let insertBtn = $('#insert-btn');
insertBtn.removeClass("pulse-primary");
insertBtn.removeClass("btn-outline-primary");
insertBtn.removeClass("btn-light");
insertBtn.addClass("btn-warning");
this.pdfViewer.promiseToggleFields(false);
this.refreshAfterPageChange();
$(".spot").each(function () {
Expand Down Expand Up @@ -837,6 +848,12 @@ export class WorkspacePdf {
}

$('#infos').show();
$('#insert-btn-div').show();
let insertBtn = $('#insert-btn');
insertBtn.addClass("pulse-primary");
insertBtn.addClass("btn-outline-primary");
insertBtn.addClass("btn-light");
insertBtn.removeClass("btn-warning");
this.pdfViewer.rotation = 0;
if (this.currentSignRequestParamses != null && this.currentSignRequestParamses.length > 0 && this.currentSignRequestParamses[0] != null) {
if (this.forcePageNum) {
Expand Down Expand Up @@ -879,6 +896,7 @@ export class WorkspacePdf {
$('#infos').hide();
$('#postit').hide();
$('#refusetools').hide();
$('#insert-btn-div').hide();
$('#rotateleft').prop('disabled', true);
$('#rotateright').prop('disabled', true);
$('#rotateleft').css('opacity', 0);
Expand Down Expand Up @@ -1049,7 +1067,11 @@ export class WorkspacePdf {
if (mode === "comment" && this.mode !== "comment") {
this.enableCommentMode();
} else {
this.enableSignMode();
if(this.signable) {
this.enableSignMode();
} else {
this.enableReadMode();
}
}
if (mode === "read") {
this.enableReadMode();
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/templates/admin/ws-access-token/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ <h5 class="text-center"><b>Tokens d'API</b></h5>
<p th:unless="${wsAccessToken.workflows.size() > 0}">Tous les workflows</p>
</td>
<td>
<input type="text" style="width: 100%;" disabled th:if="${wsAccessToken.token != null}" th:value="${wsAccessToken.token}"></input>
<input type="text" style="width: 100%;" disabled th:if="${wsAccessToken.token != null}" th:value="${wsAccessToken.token}">
<p th:unless="${wsAccessToken.token != null}">Configuration par défaut : web services accessibles sans token, restriction par IP (voir application.yml).<br>Pour ajouter la sécurisation par token, vous pouvez régénérer ce token ou le supprimer puis créer vos propres tokens</p>
</td>
<td>
<a th:href="'/admin/ws-access-token/toggle-public/' + ${wsAccessToken.getId()}" type="button" class="btn btn-transparent">
<i th:if="${wsAccessToken.publicAccess}" class="fa-solid fa-unlock text-dark"></i>
<i th:unless="${wsAccessToken.publicAccess}" class="fa-solid fa-lock text-success"></i>
<i th:if="${wsAccessToken.publicAccess}" class="fa-solid fa-unlock text-dark" title="Verrouiller l'accès"></i>
<i th:unless="${wsAccessToken.publicAccess}" class="fa-solid fa-lock text-success" title="Autoriser l'accès sans le token"></i>
</a>
</td>
<td class="text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<span title="Étape refusée" th:if="${signRequest.status == T(org.esupportail.esupsignature.entity.enums.SignRequestStatus).refused}" class="bs-stepper-circle bg-danger">
<i class="fa-solid fa-times"></i>
</span>
<th:block th:if="${signRequest.status != T(org.esupportail.esupsignature.entity.enums.SignRequestStatus).refused && signRequest.status != T(org.esupportail.esupsignature.entity.enums.SignRequestStatus).pending}" class="bs-stepper-circle bg-success">
<th:block th:if="${signRequest.status != T(org.esupportail.esupsignature.entity.enums.SignRequestStatus).refused && signRequest.status != T(org.esupportail.esupsignature.entity.enums.SignRequestStatus).pending && signRequest.status != T(org.esupportail.esupsignature.entity.enums.SignRequestStatus).draft}" class="bs-stepper-circle bg-success">
<th:block title="Étape terminée" th:if="${!liveWorkflowStep.getAutoSign()}">
<span title="Etape visé" th:if="${liveWorkflowStep.signType == T(org.esupportail.esupsignature.entity.enums.SignType).visa || liveWorkflowStep.signType == T(org.esupportail.esupsignature.entity.enums.SignType).hiddenVisa}" class="bs-stepper-circle bg-success">
<i class="fa-solid fa-check"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
<i class="fa-solid fa-redo"></i>
</button>
<div class="border ms-1 me-2"></div>
<div>
<button th:if="${editable}" class="btn btn-light btn-outline-primary pulse-primary me-1"
<div id="insert-btn-div">
<button id="insert-btn" th:if="${editable}" class="btn btn-light btn-outline-primary pulse-primary me-1"
data-bs-toggle="collapse" href="#second-tools">
<i class="fa-solid fa-plus"></i> <span class="d-none d-xl-inline">Menu insertion</span>
</button>
Expand Down Expand Up @@ -107,11 +107,11 @@
</div>
<div id="commentsTools" th:if="${toSignDocument.contentType == 'application/pdf' && editable}" class="alert alert-light d-flex flex-column d-none text-start gap-1" style="display: none;">
<button id="addCommentButton"
class="btn btn-outline-primary text-start">
class="btn btn-warning text-start">
<i class="fa-solid fa-comment"></i> Ajouter une annotation
</button>
<button th:if="${isManager && signRequest.data == null}" id="addSpotButton"
class="btn btn-outline-primary text-start">
class="btn btn-warning text-start">
<i class="fa-solid fa-map-marker-alt"></i> Ajouter un emplacement de signature
</button>
</div>
Expand Down

0 comments on commit ce28162

Please sign in to comment.