Commit 0e1cb568 authored by Damien's avatar Damien

Merge branch 'develop' into 'master'

Develop

See merge request !51
parents d0c4887b 0cef303a
Pipeline #11638 failed with stage
......@@ -51,81 +51,85 @@ job_php-7.3:
except:
- schedules
#
#commits:
# image: debian:10-slim
# stage: synchronization
# except:
# - tags
# - schedules
# before_script:
# # Skip the synchronisation if it is not enabled
# - if [ $SYNC_ENABLED = "true" ]; then echo "Sync enabled"; else echo "Sync disabled, stopping the job" && exit 0; fi
# # Configure ssh, with the private key to push to the private repository
# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# - eval $(ssh-agent -s)
# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
# - mkdir -p ~/.ssh
# - chmod 700 ~/.ssh
# - ssh-keyscan "$GITLAB_URL" >> ~/.ssh/known_hosts
# - chmod 644 ~/.ssh/known_hosts
# # Install git command
# - apt install -y git
# script:
# - git remote set-url origin $PRIVATE_REPOSITORY_URL_SSH
# - git config --global user.email "$CI_EMAIL" && git config --global user.name "$CI_USER"
# - 'exists=`git show-ref refs/heads/$CI_COMMIT_REF_NAME` && if [ -n "$exists" ]; then git branch -D $CI_COMMIT_REF_NAME; fi'
# - git pull --rebase origin $CI_COMMIT_REF_NAME
# - git checkout -b $CI_COMMIT_REF_NAME
# - git push origin --all
#
#tags:
# image: debian:10-slim
# stage: synchronization
# only:
# - tags
# except:
# - schedules
# before_script:
# # Skip the synchronisation if it is not enabled
# - if [ $SYNC_ENABLED = "true" ]; then echo "Sync enabled"; else echo "Sync disabled, stopping the job" && exit 0; fi
# # Configure ssh, with the private key to push to the private repository
# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# - eval $(ssh-agent -s)
# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
# - mkdir -p ~/.ssh
# - chmod 700 ~/.ssh
# - ssh-keyscan "$GITLAB_URL" >> ~/.ssh/known_hosts
# - chmod 644 ~/.ssh/known_hosts
# # Install git and curl command
# - apt install -y git
# - apt install -y curl
# # Install npm
# - curl -sL https://deb.nodesource.com/setup_14.x | bash -
# - apt install -y nodejs
# script:
# - git config --global user.email "$CI_EMAIL" && git config --global user.name "$CI_USER"
# # We will work in another directory, to avoid git conflicts
# - mkdir tmp
# - cd tmp
# # Find the branch name from tag name
# - VERSION1=$(echo $CI_COMMIT_TAG| cut -d'.' -f 1)
# - VERSION2=$(echo $CI_COMMIT_TAG| cut -d'.' -f 2)
# - VERSION="${VERSION1}.${VERSION2}"
# # Pull the private repository
# - git init && git remote add origin $PRIVATE_REPOSITORY_URL_SSH
# - git pull origin $VERSION
# # Update and push build prod
# - npm install
# - npm run build-prod
# - git status
# - git add -f dist/
# - git status
# - git commit -m "Build prod for tag ${CI_COMMIT_TAG}"
# - git show-ref
# - git push origin HEAD:$VERSION
# - git status
# # Do the tag on the private repo
# - git tag $CI_COMMIT_TAG
# - git status
# - git push origin --tags
commits:
image: debian:10-slim
stage: synchronization
only:
- master
- develop
- "21.03"
except:
- tags
- schedules
before_script:
# Skip the synchronisation if it is not enabled
- if [ $SYNC_ENABLED = "true" ]; then echo "Sync enabled"; else echo "Sync disabled, stopping the job" && exit 0; fi
# Configure ssh, with the private key to push to the private repository
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan "$GITLAB_URL" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
# Install git command
- apt install -y git
script:
- git remote set-url origin $PRIVATE_REPOSITORY_URL_SSH
- git config --global user.email "$CI_EMAIL" && git config --global user.name "$CI_USER"
- 'exists=`git show-ref refs/heads/$CI_COMMIT_REF_NAME` && if [ -n "$exists" ]; then git branch -D $CI_COMMIT_REF_NAME; fi'
- git pull --rebase origin $CI_COMMIT_REF_NAME
- git checkout -b $CI_COMMIT_REF_NAME
- git push origin --all
tags:
image: debian:10-slim
stage: synchronization
only:
- tags
except:
- schedules
before_script:
# Skip the synchronisation if it is not enabled
- if [ $SYNC_ENABLED = "true" ]; then echo "Sync enabled"; else echo "Sync disabled, stopping the job" && exit 0; fi
# Configure ssh, with the private key to push to the private repository
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan "$GITLAB_URL" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
# Install git and curl command
- apt install -y git
- apt install -y curl
# Install npm
- curl -sL https://deb.nodesource.com/setup_14.x | bash -
- apt install -y nodejs
script:
- git config --global user.email "$CI_EMAIL" && git config --global user.name "$CI_USER"
# We will work in another directory, to avoid git conflicts
- mkdir tmp
- cd tmp
# Find the branch name from tag name
- VERSION1=$(echo $CI_COMMIT_TAG| cut -d'.' -f 1)
- VERSION2=$(echo $CI_COMMIT_TAG| cut -d'.' -f 2)
- VERSION="${VERSION1}.${VERSION2}"
# Pull the private repository
- git init && git remote add origin $PRIVATE_REPOSITORY_URL_SSH
- git pull origin $VERSION
# Update and push build prod
- npm install
- npm run build-prod
- git status
- git add -f dist/
- git status
- git commit -m "Build prod for tag ${CI_COMMIT_TAG}"
- git show-ref
- git push origin HEAD:$VERSION
- git status
# Do the tag on the private repo
- git tag $CI_COMMIT_TAG
- git status
- git push origin --tags
......@@ -36,13 +36,13 @@
</docaposteSignature>
<!-- Sort by the more secure to the less secure mode -->
<signatureModes>
<mode>
<!-- <mode>
<id>rgs_2stars_timestamped</id>
<color>#FF0000</color>
<issuer>ChamberSign</issuer>
<subject></subject>
<keyUsage>digitalSignature</keyUsage>
</mode>
</mode> -->
<mode>
<id>rgs_2stars</id>
<color>#FF0000</color>
......@@ -50,23 +50,23 @@
<subject></subject>
<keyUsage>digitalSignature</keyUsage>
</mode>
<mode>
<!-- <mode>
<id>inca_card_eidas</id>
<color>#FFA500</color>
<issuer></issuer>
<subject></subject>
<keyUsage>digitalSignature</keyUsage>
</mode>
<mode>
</mode> -->
<!-- <mode>
<id>inca_card</id>
<color>#FFA500</color>
<issuer></issuer>
<subject></subject>
<keyUsage>digitalSignature</keyUsage>
</mode>
<mode>
</mode> -->
<!-- <mode>
<id>eidas</id>
<color>#00FF00</color>
</mode>
</mode> -->
</signatureModes>
</ROOT>
......@@ -410,6 +410,7 @@
"errorUserSignType": "Signers without a certificate must be present before signers with a certificate.",
"fortifyReadException": "Error when communicating with Fortify",
"docaposteSignatureDisabled": "The docaposteSignature parameter is not activated",
"securedUrlNeeded": "If you want to sign with a certificate, you must have a secured application (https)",
"certifiedDocumentMsg2": "Certified document! Annotations on the document will not be taken into account!",
"history": "History",
"manage_history": "Manage history",
......@@ -469,6 +470,7 @@
"refuseActionDocInMailGroup": "Do you want to refuse the other documents from a direct mail?",
"notificationDeletedUserBody": "Hello, <br/> <br/> A visa workflow you initiated was interrupted because a user was deleted. <br/> <br/> Click on the link below to view it: <br / >",
"stopProcessInfo": "Interrupted on",
"refProcessInfo": "Refused on"
"refProcessInfo": "Refused on",
"repoUrl": "https://labs.maarch.org/maarch/MaarchParapheur"
}
}
\ No newline at end of file
}
......@@ -350,6 +350,7 @@
"rgs_2stars": "Clé RGS**",
"rgs_2stars_timestamped": "Clé RGS** + horodatage",
"docaposteSignatureDisabled": "Le paramètre docaposteSignature n'est pas activé",
"securedUrlNeeded": "Pour pouvoir signer électroniquement, vous devez accéder à l'application de manière sécurisée (https)",
"noAssociatedGroup": "L'utilisateur n'appartient à aucun groupe",
"docToSign": "Document à signer",
"attachDocToSign": "Annexe attaché au(x) document(s) à signer",
......@@ -465,6 +466,7 @@
"undefined": "Non défini",
"refuseActionDocInMailGroup": "Voulez-vous refuser les autres documents issus d'un publipostage ?",
"stopProcessInfo": "Interrompu le",
"refProcessInfo": "Refusé le"
"refProcessInfo": "Refusé le",
"repoUrl": "https://labs.maarch.org/maarch/MaarchParapheur"
}
}
......@@ -6,15 +6,15 @@ TRUNCATE TABLE adr_attachments;
TRUNCATE TABLE workflows;
TRUNCATE TABLE signatures;
INSERT INTO adr_attachments (id, attachment_id, type, path, filename, fingerprint) VALUES (1, 1, 'ATTACH', '2021/03/0001/', '0001_1122844471.pdf', 'cd6aefd46cb9b88a7c163f549b77135f8409634ca246d5344c8002f67e173d3e75fb6503bc74f09bb4f86a55ae1091d5aabb1bd6addf3e5930318b2d19d6827c');
INSERT INTO adr_attachments (id, attachment_id, type, path, filename, fingerprint) VALUES (1, 1, 'ATTACH', '2021/03/0001/', '0001_1122844471.pdf', '145c6232b1f90cacf7c713b898a008b7b5f19586bc8af26acaafa27d61f4333abc97657cf4329cef36aefd0b3e2e899b8dd0ab947476fb5e9a6d4e3bd359e19a');
INSERT INTO adr_attachments (id, attachment_id, type, path, filename, fingerprint) VALUES (2, 1, 'TNL1', '2021/03/0001/', '0002_1616006431.png', '330aa4781bde307551a4299cce9ff48c0084ad872db68ac265012bee9062c37b3f2e21be68d0a50d5bade6a8bf795c74308c1a88ffa1fe230eab0b484e7751fb');
INSERT INTO adr_attachments (id, attachment_id, type, path, filename, fingerprint) VALUES (3, 2, 'ATTACH', '2021/03/0001/', '0003_434570376.pdf', '33e9e2b5cfacd1c0f5b3efe84f1d16719acd4b5ccad1b899edc90cc1fd294d1c3347f6c9f3cf4e2698e0a8467fe2758d551e059561d0894f6b6e23b415cbd1f8');
INSERT INTO adr_attachments (id, attachment_id, type, path, filename, fingerprint) VALUES (3, 2, 'ATTACH', '2021/03/0001/', '0003_434570376.pdf', 'f8f08880dd2ff0099ae32e94748ca327cde72067f6686b5d7ff21258a081c3bf0b026f3ccb00c3de1dff6de71dec21b154db2e73d63442bfb1bc6b156322dac5');
INSERT INTO adr_attachments (id, attachment_id, type, path, filename, fingerprint) VALUES (4, 2, 'TNL1', '2021/03/0001/', '0004_1117633033.png', 'f5fd69202a3d498740759c64ff0839e949f36c5481cbbbe4061ebbc5d5d13f1b70ec3bbc36a033f342e5c1405b4b288ef7168636451d14a91c1bf47618edfd83');
INSERT INTO adr_attachments (id, attachment_id, type, path, filename, fingerprint) VALUES (5, 3, 'ATTACH', '2021/03/0001/', '0005_792090115.pdf', 'cd6aefd46cb9b88a7c163f549b77135f8409634ca246d5344c8002f67e173d3e75fb6503bc74f09bb4f86a55ae1091d5aabb1bd6addf3e5930318b2d19d6827c');
INSERT INTO adr_attachments (id, attachment_id, type, path, filename, fingerprint) VALUES (5, 3, 'ATTACH', '2021/03/0001/', '0005_792090115.pdf', '145c6232b1f90cacf7c713b898a008b7b5f19586bc8af26acaafa27d61f4333abc97657cf4329cef36aefd0b3e2e899b8dd0ab947476fb5e9a6d4e3bd359e19a');
INSERT INTO adr_attachments (id, attachment_id, type, path, filename, fingerprint) VALUES (6, 3, 'TNL1', '2021/03/0001/', '0006_584633965.png', 'e0719cd806755d0da932e66a0670f35238a701b4e01abf72134c3999e98cb7a748d3b399ac1ed800e49309e081fd63fece56798a4b03e6a6215a46bf8570a976');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (1, 1, 'DOC', '2021/03/0001/', '0001_1384300851.pdf', '8534dbffd7c7ecbf19e339dd15e155c7325c789e430fa320612d578d777c0a7950d17b59f26dd5282ab53f902c5697aec20adb554888c6b8046df8d62ee6605b');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (2, 1, 'ORIGINAL', '2021/03/0001/', '0001_19271208.pdf', '8534dbffd7c7ecbf19e339dd15e155c7325c789e430fa320612d578d777c0a7950d17b59f26dd5282ab53f902c5697aec20adb554888c6b8046df8d62ee6605b');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (1, 1, 'DOC', '2021/03/0001/', '0001_1384300851.pdf', '4337ac88f061abb5b51865a3c5c6b3317c8f38ac93680e15f328d153caa5ff9effbcba7a402db0a043774f988a29bac1fedfd1843c5aa4517209909da28d81fa');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (2, 1, 'ORIGINAL', '2021/03/0001/', '0001_19271208.pdf', '4337ac88f061abb5b51865a3c5c6b3317c8f38ac93680e15f328d153caa5ff9effbcba7a402db0a043774f988a29bac1fedfd1843c5aa4517209909da28d81fa');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (3, 1, 'TNL1', '2021/03/0001/', '0002_810518394.png', 'c05b7229c9222f60bceb5cf882e950a1f003cbc039818708876cd3c20ac3a8152bb46b3454223efccedd1ab1b9add4e40341e568f822ce1eecf27ff9afdc89ef');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (4, 1, 'TNL2', '2021/03/0001/', '0003_559568.png', '5535e1582a3fe61d9f2b2564a99448434d26ae0a4eb4b71081ff38cfb1ed5fd1b52c4d2c4a406f923d3e00c4a57c084fc19843a40603be4fc3867e9c4338d530');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (5, 1, 'TNL3', '2021/03/0001/', '0004_820368033.png', '93bcde9eb3f784906373b088100251228e308db33a1754a2ee1f1d966ea7946f86e4a78701a9abe8dc0ada9aea97b13623db56a29e4ba6f4688f64294a5ecd77');
......@@ -23,13 +23,13 @@ INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fing
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (8, 1, 'TNL6', '2021/03/0001/', '0007_1532491200.png', 'c9780fc41b67adad09da02e809c34d138fcf648b3291b9521876cb076dc1a317c77df96bdaf55e82b1722e383d8a055f1f0fd1c41510e9eb6d77fad0b1a8feb4');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (9, 1, 'TNL7', '2021/03/0001/', '0008_1699444298.png', 'dfbf1c25e98c9cca4de573d78db7859c2ff539053126a9ba124ef6820842c76a2d169cc2cd24e55a82cb944b174ce29253d01d12e26598de5f24ae9136822b9a');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (10, 1, 'TNL8', '2021/03/0001/', '0009_1238226733.png', 'f18222eb71bb4ca387c1a7c97bd1cb1c9c8231a3f30bee3997199da73907a9f676cbceba2b385c7a7d4c662b51b7a2e9427d7ff9eb612399a4e1320daf418bfa');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (11, 2, 'DOC', '2021/03/0001/', '0010_1599286099.pdf', 'ac8afa05dacbf7764b1d6bb7c26f69657ef0224c0804c0f679ee9795491bd6a4326dad41ad01d8c6be7406eb470f3a723a7e0aef6da035f0ba52f3a7e0533f48');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (12, 2, 'ORIGINAL', '2021/03/0001/', '0002_184634841.pdf', 'ac8afa05dacbf7764b1d6bb7c26f69657ef0224c0804c0f679ee9795491bd6a4326dad41ad01d8c6be7406eb470f3a723a7e0aef6da035f0ba52f3a7e0533f48');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (11, 2, 'DOC', '2021/03/0001/', '0010_1599286099.pdf', '79f429dd54f078e9445d556137a2cb1ffed83f4fc499091a8b28a7ab702eec7d21b4cd940572749623a6d10bae323f31df3597a1df46bcc6d97c3abc5f6e9f3a');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (12, 2, 'ORIGINAL', '2021/03/0001/', '0002_184634841.pdf', '79f429dd54f078e9445d556137a2cb1ffed83f4fc499091a8b28a7ab702eec7d21b4cd940572749623a6d10bae323f31df3597a1df46bcc6d97c3abc5f6e9f3a');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (13, 2, 'TNL1', '2021/03/0001/', '0011_1360027044.png', '420d1bf71b670cb72aea0aa53902265e6da8c4fc901dbfb29563675f7dcf026a61160470cf2639e6790886b965b4437543fe0e8fab818e0460a644140730c429');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (14, 2, 'TNL2', '2021/03/0001/', '0012_1536140505.png', 'f9870b768dacabb08c58dde098a2cf88c790ef10da951a6d8b8e76698842985cfcbc63b1f7cb54f6da656ef7c4821f5673657b6a3615e7666c94109351d7cc88');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (15, 2, 'TNL3', '2021/03/0001/', '0013_1988334255.png', '6ed1cf5613c75890aa61ab9f7b55f858b50a626412aa2b7e8d9b573c0e45ac81e6cbc881b6ce3cbcde4a722875cfbbade0de7963a4e5b1c29bcf60447b16187e');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (16, 3, 'DOC', '2021/03/0001/', '0014_2067613522.pdf', 'd783515ed319457b56bb5a4fadde12dd71ac638e0839b0bf57e0ef4bb3ea221edbc407b502a81be4a09789b6ec59babbefce90863e086ae37b55dc652f9739f5');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (17, 3, 'ORIGINAL', '2021/03/0001/', '0003_349212133.pdf', 'd783515ed319457b56bb5a4fadde12dd71ac638e0839b0bf57e0ef4bb3ea221edbc407b502a81be4a09789b6ec59babbefce90863e086ae37b55dc652f9739f5');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (16, 3, 'DOC', '2021/03/0001/', '0014_2067613522.pdf', '6d3562943c05bc930238f25143e72158c3d19964f8095e6c7cc9e349354705b670d0cc4e48ab486bba27eae937637456670c6975705f7d6b049d45c54f7818e1');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (17, 3, 'ORIGINAL', '2021/03/0001/', '0003_349212133.pdf', '6d3562943c05bc930238f25143e72158c3d19964f8095e6c7cc9e349354705b670d0cc4e48ab486bba27eae937637456670c6975705f7d6b049d45c54f7818e1');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (18, 3, 'TNL1', '2021/03/0001/', '0015_627133066.png', '292ec5f24cee84812eb4c7e759f85c651c3490248e4dd62d2f6e80a01bce640b4dd2d928eff5536ac96fe1d9ecb6d83b286705a5b9ceb997339b9a39ffcd71b2');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (19, 3, 'TNL2', '2021/03/0001/', '0016_1414080446.png', '9f9f192780a0c81f0e3498af1cee7eb3ed5d8abd820bc903aeda7698a949b08045656a22ba91738cb62ffaa6c162de673038e7ae8f4d97b1b79602f26a0e35b2');
INSERT INTO adr_main_documents (id, main_document_id, type, path, filename, fingerprint) VALUES (20, 3, 'TNL3', '2021/03/0001/', '0017_1560371968.png', '7a15de2c83b0c76b39fdeb4300f0456e0acfab5561a00d718c40f4ca468af046ea0d0e781fbd4707a9f6b98beb69de239ebe10b9a25a0ab60ba70d7b8da01194');
......
......@@ -20,6 +20,7 @@ use Email\controllers\EmailController;
use Group\controllers\PrivilegeController;
use Respect\Validation\Validator;
use setasign\Fpdi\Tcpdf\Fpdi;
use SrcCore\controllers\UrlController;
use SrcCore\models\CoreConfigModel;
use Attachment\models\AttachmentModel;
use Docserver\controllers\DocserverController;
......@@ -117,7 +118,7 @@ class DocumentController
$documents[$key]['mode'] = $workflowsShortcut[$document['id']]['mode'];
$documents[$key]['owner'] = $workflowsShortcut[$document['id']]['user_id'] == $userId;
}
foreach ($countWorkflows as $mode) {
$count[$mode['mode']] = $mode['count'];
}
......@@ -274,7 +275,7 @@ class DocumentController
$fileContent = file_get_contents($pathToDocument);
$finfo = new \finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->buffer($fileContent);
if (empty($queryParams['mode']) || $queryParams['mode'] == 'base64') {
return $response->withJson(['encodedDocument' => base64_encode($fileContent)]);
} else {
......@@ -291,9 +292,9 @@ class DocumentController
if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'indexation'])) {
return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']);
}
$body = $request->getParsedBody();
if (empty($body)) {
return $response->withStatus(400)->withJson(['errors' => 'Body is not set or empty']);
} elseif (!Validator::notEmpty()->validate($body['encodedDocument'])) {
......@@ -307,7 +308,7 @@ class DocumentController
} elseif (!Validator::stringType()->length(0, 64)->validate($body['reference'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body reference is too loong or not a string']);
}
$body['attachments'] = empty($body['attachments']) ? [] : $body['attachments'];
foreach ($body['attachments'] as $key => $attachment) {
if (!Validator::notEmpty()->validate($attachment['encodedDocument'])) {
......@@ -317,7 +318,7 @@ class DocumentController
}
}
$hasEidas = false;
$hasElectronicSignature = false;
foreach ($body['workflow'] as $key => $workflow) {
......@@ -365,7 +366,7 @@ class DocumentController
$body['workflow'][$key]['userId'] = $processingUser['id'];
}
$libDir = CoreConfigModel::getLibrariesDirectory();
$loadedXml = CoreConfigModel::getConfig();
if ($loadedXml->docaposteSignature->enable == 'true' && $hasEidas && (empty($libDir) || !is_file($libDir . 'SetaPDF-Signer/library/SetaPDF/Autoload.php'))) {
......@@ -379,7 +380,7 @@ class DocumentController
} else {
$encodedDocument['encodedDocument'] = $body['encodedDocument'];
}
if (!empty($encodedDocument['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $encodedDocument['errors']]);
}
......@@ -391,7 +392,7 @@ class DocumentController
return $response->withStatus(400)->withJson(['errors' => 'Document is not a pdf']);
}
if (!empty($libDir) && is_file($libDir . 'SetaPDF-FormFiller-Full/library/SetaPDF/Autoload.php')) {
require_once($libDir . 'SetaPDF-FormFiller-Full/library/SetaPDF/Autoload.php');
......@@ -412,14 +413,14 @@ class DocumentController
unlink($targetFile);
}
try {
$storeInfos = DocserverController::storeResourceOnDocServer([
'encodedFile' => $encodedDocument['encodedDocument'],
'format' => 'pdf',
'docserverType' => 'DOC'
]);
if (!empty($storeInfos['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $storeInfos['errors']]);
}
......@@ -434,7 +435,7 @@ class DocumentController
}
DatabaseModel::beginTransaction();
$id = DocumentModel::create([
'title' => $body['title'],
'reference' => empty($body['reference']) ? null : $body['reference'],
......@@ -448,7 +449,7 @@ class DocumentController
'typist' => $GLOBALS['id'],
'mailing_id' => !empty($body['mailingId']) ? (string)$body['mailingId'] : null
]);
AdrModel::createDocumentAdr([
'documentId' => $id,
......@@ -457,14 +458,14 @@ class DocumentController
'filename' => $storeInfos['filename'],
'fingerprint' => $storeInfos['fingerprint']
]);
$storeInfos = DocserverController::storeResourceOnDocServer([
'encodedFile' => $encodedDocument['encodedDocument'],
'format' => 'pdf',
'docserverType' => 'ORIGINAL'
]);
if (!empty($storeInfos['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $storeInfos['errors']]);
}
......@@ -475,7 +476,7 @@ class DocumentController
'filename' => $storeInfos['filename'],
'fingerprint' => $storeInfos['fingerprint']
]);
foreach ($body['workflow'] as $key => $workflow) {
if (!SignatureController::isValidSignatureMode(['mode' => $workflow['signatureMode']])) {
......@@ -523,7 +524,7 @@ class DocumentController
return $response->withStatus(500)->withJson(['errors' => $e->getMessage()]);
}
$workflow = WorkflowModel::get([
'select' => ['id', 'user_id', 'signature_mode'],
'where' => ['mode = ?', 'main_document_id = ?'],
......@@ -537,13 +538,13 @@ class DocumentController
return $response->withStatus(500)->withJson(['errors' => $result['errors']]);
}
}
EmailController::sendNotification(['documentId' => $id, 'userId' => $GLOBALS['id']]);
$configPath = CoreConfigModel::getConfigPath();
exec("php src/app/convert/scripts/ThumbnailScript.php '{$configPath}' {$id} 'document' '{$GLOBALS['id']}' > /dev/null &");
return $response->withJson(['id' => $id]);
}
......@@ -566,6 +567,13 @@ class DocumentController
return $response->withStatus(500)->withJson(['errors' => 'SetaPDF-Signer library is not installed', 'lang' => 'setAPdfSignerError']);
}
require_once($libDir . 'SetaPDF-Signer/library/SetaPDF/Autoload.php');
if ($workflow['signature_mode'] != 'eidas') {
$url = UrlController::getCoreUrl();
if (strpos($url, 'https://') !== 0) {
return $response->withStatus(400)->withJson(['errors' => 'Url is not secured (https needed)', 'lang' => 'securedUrlNeeded']);
}
}
}
if (in_array($workflow['signature_mode'], ['eidas', 'inca_card_eidas']) && $loadedXml->docaposteSignature->enable != 'true') {
return $response->withStatus(400)->withJson(['errors' => 'docaposteSignature is disabled', 'lang' => 'docaposteSignatureDisabled']);
......@@ -684,7 +692,7 @@ class DocumentController
if (!empty($storeInfos['errors'])) {
return $response->withStatus(500)->withJson(['errors' => $storeInfos['errors']]);
}
AdrModel::deleteDocumentAdr([
'where' => ['main_document_id = ?', 'type = ?'],
'data' => [$args['id'], 'ESIGN']
......
......@@ -21,8 +21,6 @@ use History\controllers\HistoryController;
use Respect\Validation\Validator;
use Slim\Http\Request;
use Slim\Http\Response;
use SrcCore\controllers\LanguageController;
use SrcCore\controllers\UrlController;
use SrcCore\models\AuthenticationModel;
use SrcCore\models\CoreConfigModel;
use SrcCore\models\PasswordModel;
......@@ -44,12 +42,14 @@ class AuthenticationController
$connection = ConfigurationModel::getConnection();
$encryptKey = CoreConfigModel::getEncryptKey();
$path = CoreConfigModel::getConfigPath();
$coreUrl = UrlController::getCoreUrl();
$hashedPath = md5($path);
return $response->withJson([
'connection' => $connection,
'changeKey' => $encryptKey == 'Security Key Maarch Parapheur #2008',
'instanceId' => $hashedPath
'connection' => $connection,
'changeKey' => $encryptKey == 'Security Key Maarch Parapheur #2008',
'instanceId' => $hashedPath,
'coreUrl' => $coreUrl
]);
}
......@@ -99,7 +99,7 @@ class AuthenticationController
}
$login = strtolower($body['login']);
if ($connection == 'ldap') {
$ldapConfigurations = ConfigurationModel::getByIdentifier(['identifier' => 'ldapServer', 'select' => ['value']]);
if (empty($ldapConfigurations)) {
......
<ion-header [translucent]="true">
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button menu="left-menu"></ion-menu-button>
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{'lang.manage_connections' | translate}}</ion-title>
......
<ion-header [translucent]="true">
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button menu="left-menu"></ion-menu-button>
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{'lang.administration' | translate}} {{'lang.manage_ldap_configurationsAlt' | translate}}
......
<ion-header [translucent]="true">
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button menu="left-menu"></ion-menu-button>
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{title}}</ion-title>
......
<ion-header [translucent]="true">
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button menu="left-menu"></ion-menu-button>
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{title}}</ion-title>
......@@ -16,17 +17,13 @@
<ion-item lines="none" *ngIf="!creationMode">
<ion-label color="secondary">{{'lang.privileges' | translate}} :</ion-label>
</ion-item>
<ion-grid *ngIf="!creationMode">
<ion-row>
<ion-col size="4" *ngFor="let privilege of group.privileges">
<ion-item style="cursor: pointer">
<ion-toggle slot="start" [name]="privilege.id" color="primary" [checked]="privilege.checked"
[(ngModel)]="privilege.checked" (click)="togglePrivilege(privilege, true)"></ion-toggle>
<ion-label (click)="togglePrivilege(privilege, false)">{{'lang.' + privilege.id + 'Admin' | translate}}</ion-label>
</ion-item>
</ion-col>
</ion-row>
</ion-grid>
<div style="display: grid;grid-gap: 10px;" [class.grid-2-col]="signaturesService.mobileMode" [class.grid-3-col]="!signaturesService.mobileMode">
<ion-item style="cursor: pointer" *ngFor="let privilege of group.privileges">
<ion-toggle slot="start" [name]="privilege.id" color="primary" [checked]="privilege.checked"
[(ngModel)]="privilege.checked" (click)="togglePrivilege(privilege, true)"></ion-toggle>
<ion-label (click)="togglePrivilege(privilege, false)">{{'lang.' + privilege.id + 'Admin' | translate}}</ion-label>
</ion-item>
</div>
<ion-item lines="none" *ngIf="!creationMode">
<ion-label color="secondary">{{'lang.linkedUsers' | translate}} :</ion-label>
</ion-item>
......
......@@ -21,3 +21,11 @@ fieldset {
legend {
color: #F99830;
}
.grid-2-col {
grid-template-columns: repeat(2, 1fr);
}
.grid-3-col {
grid-template-columns: repeat(3, 1fr);
}
\ No newline at end of file
<ion-header [translucent]="true">
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{'lang.administration' | translate}} {{'lang.manage_groupsAlt' | translate}}</ion-title>
</ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-button fill="outline" shape="round" routerLink="/administration/groups/new">
{{'lang.groupCreation' | translate}}
</ion-button>
</ion-buttons>
<ion-title slot="end" color="secondary">{{groupList.length}} {{'lang.manage_groupsAlt' | translate}}</ion-title>
</ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button menu="left-menu"></ion-menu-button>
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{'lang.administration' | translate}} {{'lang.manage_groupsAlt' | translate}}</ion-title>
</ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-button fill="outline" shape="round" routerLink="/administration/groups/new">
{{'lang.groupCreation' | translate}}
</ion-button>
</ion-buttons>
<ion-title slot="end" color="secondary">{{groupList.length}} {{'lang.manage_groupsAlt' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content #mainContent>
<ion-list>
<ion-item style="display: flex;">
<ion-label color="primary" matSort [matSortActive]="displayedColumns[0]" matSortDirection='asc' style="display: flex;font-size: 12px;align-items: center;" (matSortChange)="sortData($event)">
<ng-container *ngFor="let col of displayedColumns">
<div [mat-sort-header]="col" disableClear style="flex: 1" *ngIf="col!=='actions'">
{{'lang.' + col | translate}}
</div>
</ng-container>
<div style="flex: 1" *ngIf="displayedColumns.indexOf('actions') > -1">
<ion-searchbar [placeholder] = "'lang.filter' | translate" style="padding: 1px;" (ionChange)="applyFilter($event.detail.value)"></ion-searchbar>
</div>
</ion-label>
<ion-button slot="end" fill="clear" shape="round" disabled>
<ion-icon></ion-icon>
</ion-button>
</ion-item>
<ion-virtual-scroll [items]="sortedData" approxItemHeight="50px">
<ion-item *virtualItem="let element" style="display: flex;">
<ion-label style="display: flex;cursor: pointer;" routerLink="/administration/groups/{{element.id}}">
<div style="flex: 1" *ngFor="let col of displayedColumns">
{{element[col]}}
</div>
</ion-label>
<ion-button slot="end" fill="clear" shape="round" (click)="$event.stopPropagation();delete(element)" title="{{'lang.delete' | translate}}">
<ion-icon color="danger" slot="icon-only" name="trash"></ion-icon>
</ion-button>
</ion-item>
</ion-virtual-scroll>
</ion-list>
<ion-list>
<ion-item style="display: flex;">
<ion-label color="primary" matSort [matSortActive]="displayedColumns[0]" matSortDirection='asc'
style="display: flex;font-size: 12px;align-items: center;" (matSortChange)="sortData($event)">
<ng-container *ngFor="let col of displayedColumns">
<div [mat-sort-header]="col" disableClear style="flex: 1" *ngIf="col!=='actions'">
{{'lang.' + col | translate}}
</div>
</ng-container>
<div style="flex: 1" *ngIf="displayedColumns.indexOf('actions') > -1">
<ion-searchbar [placeholder]="'lang.filter' | translate" style="padding: 1px;"
(ionChange)="applyFilter($event.detail.value)"></ion-searchbar>
</div>
</ion-label>
<ion-button slot="end" fill="clear" shape="round" disabled>
<ion-icon></ion-icon>
</ion-button>
</ion-item>
<ion-virtual-scroll [items]="sortedData" approxItemHeight="50px">
<ion-item *virtualItem="let element" style="display: flex;">
<ion-label style="display: flex;cursor: pointer;" routerLink="/administration/groups/{{element.id}}">
<div style="flex: 1" *ngFor="let col of displayedColumns">
{{element[col]}}
</div>
</ion-label>
<ion-button slot="end" fill="clear" shape="round" (click)="$event.stopPropagation();delete(element)"
title="{{'lang.delete' | translate}}">
<ion-icon color="danger" slot="icon-only" name="trash"></ion-icon>
</ion-button>
</ion-item>
</ion-virtual-scroll>