diff --git a/lang/en.json b/lang/en.json index 864951d323341c33e5d39442a43b8bcd1b257a03..c31257f10a7557ab7a495c94a9532bd0e716f9e7 100755 --- a/lang/en.json +++ b/lang/en.json @@ -159,7 +159,6 @@ "search": "Search", "substitute": "Substitute user", "substitution": "Substitution", - "signSubstituted": "Signatures to substitute", "chooseSubstitute": "Choose a substitute", "noResult": "No result", "circuit": "Circuit", @@ -171,7 +170,6 @@ "substitutionDeleted": "Substitution deleted", "substitutionInfo": "You are in substitution mode, you can't make any action", "substitutedDoc": "Substituted document", - "substitutedSignature": "Substituted signature", "substituteMsg": "You act as", "substitutionWarn": "You choose a substitution, you will not be able to make any action.", "manage_users": "Users", diff --git a/lang/fr.json b/lang/fr.json index 578b6e85305b9da9055804d2f69d088aaefa1160..fe83bff78d8f61b06cdc7a1396f7ac85f878b9e8 100755 --- a/lang/fr.json +++ b/lang/fr.json @@ -159,7 +159,6 @@ "search": "Rechercher", "substitution": "Délégation", "substitute": "Utilisateur délégataire", - "signSubstituted": "Signature(s) à déléguer", "chooseSubstitute": "Choisissez un utilisateur", "noResult": "Aucun résultat", "circuit": "Circuit", @@ -171,7 +170,6 @@ "substitutionDeleted": "Délégation supprimée", "substitutionInfo": "Vous avez délégué vos documents, vous ne pouvez pas faire d'action", "substitutedDoc": "Document délégué", - "substitutedSignature": "Signature déléguée", "substituteMsg": "Vous agissez en tant que", "substitutionWarn": "Vous avez choisi une délégation, vous ne pourrez plus faire d'action.", "manage_users": "Utilisateurs", diff --git a/rest/index.php b/rest/index.php index 226bfcd5c76e061de4634d437f801a4837f9e38b..32d1c85c3c877fb277932efdf1ed086fd4486c13 100755 --- a/rest/index.php +++ b/rest/index.php @@ -113,7 +113,6 @@ $app->get('/users/{id}/signatures', \User\controllers\SignatureController::class $app->post('/users/{id}/signatures', \User\controllers\SignatureController::class . ':create'); $app->delete('/users/{id}/signatures/{signatureId}', \User\controllers\SignatureController::class . ':delete'); $app->put('/users/{id}/externalSignatures', \User\controllers\SignatureController::class . ':updateExternalSignatures'); -$app->patch('/users/{id}/signatures/substituted', \User\controllers\SignatureController::class . ':updateSubstituted'); //Emails $app->post('/emails', \Email\controllers\EmailController::class . ':send'); diff --git a/sql/1909.sql b/sql/1909.sql new file mode 100755 index 0000000000000000000000000000000000000000..2de987ebe87d4234f096509b4568ba3ecebe301d --- /dev/null +++ b/sql/1909.sql @@ -0,0 +1,9 @@ +-- *************************************************************************-- +-- -- +-- -- +-- Model migration script - 19.07 to 19.09 -- +-- -- +-- -- +-- *************************************************************************-- + +ALTER TABLE signatures DROP COLUMN IF EXISTS substituted; diff --git a/sql/structure.sql b/sql/structure.sql index 676ce32c92ea1fda472a150cf4b22d2e08cfa95d..7f7af18f54386677bec2813789ae4da4b3778c9a 100755 --- a/sql/structure.sql +++ b/sql/structure.sql @@ -181,7 +181,6 @@ CREATE TABLE signatures path character varying(255) NOT NULL, filename character varying(255) NOT NULL, fingerprint character varying(255) NOT NULL, - substituted boolean DEFAULT FALSE NOT NULL, external_application CHARACTER VARYING(255), CONSTRAINT signatures_pkey PRIMARY KEY (id) ) diff --git a/src/app/user/controllers/SignatureController.php b/src/app/user/controllers/SignatureController.php index 991b5feb0f923ec14261b7491a243fbc7ed04850..0fdc9198d5e7b3cdffa72cf373ae914d1f9661c0 100755 --- a/src/app/user/controllers/SignatureController.php +++ b/src/app/user/controllers/SignatureController.php @@ -28,26 +28,15 @@ class SignatureController { public function get(Request $request, Response $response, array $args) { - if ($GLOBALS['id'] != $args['id']) { - $user = UserModel::getById(['id' => $args['id'], 'select' => ['substitute']]); - if (empty($user) || $user['substitute'] != $GLOBALS['id']) { - return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); - } - } - $docserver = DocserverModel::getByType(['type' => 'SIGNATURE', 'select' => ['path']]); if (empty($docserver['path']) || !is_dir($docserver['path'])) { return $response->withStatus(400)->withJson(['errors' => 'Docserver \'SIGNATURE\' does not exist']); } - $where = ['user_id = ?']; - if ($GLOBALS['id'] != $args['id']) { - $where[] = 'substituted = true'; - } $rawSignatures = SignatureModel::get([ - 'select' => ['id', 'path', 'filename', 'fingerprint', 'substituted'], - 'where' => $where, - 'data' => [$args['id']], + 'select' => ['id', 'path', 'filename', 'fingerprint'], + 'where' => ['user_id = ?'], + 'data' => [$GLOBALS['id']], 'orderBy' => ['id DESC'] ]); @@ -59,7 +48,6 @@ class SignatureController if ($signature['fingerprint'] == $fingerprint) { $signatures[] = [ 'id' => $signature['id'], - 'substituted' => $signature['substituted'], 'encodedSignature' => base64_encode(file_get_contents($pathToSignature)) ]; } @@ -203,40 +191,4 @@ class SignatureController return $response->withStatus(204); } - - public function updateSubstituted(Request $request, Response $response, array $args) - { - if ($GLOBALS['id'] != $args['id'] && !PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_users'])) { - return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); - } - - $user = UserModel::getById(['select' => [1], 'id' => $args['id']]); - if (empty($user)) { - return $response->withStatus(400)->withJson(['errors' => 'User does not exist']); - } - - $body = $request->getParsedBody(); - - if (!Validator::arrayType()->notEmpty()->validate($body['signatures'])) { - return $response->withStatus(400)->withJson(['errors' => 'Body signature is empty or not an array']); - } - - foreach ($body['signatures'] as $key => $signature) { - if (!Validator::intVal()->notEmpty()->validate($signature['id'])) { - return $response->withStatus(400)->withJson(['errors' => "Body signatures[{$key}] id is empty or not an integer"]); - } elseif (!Validator::boolType()->validate($signature['substituted'])) { - return $response->withStatus(400)->withJson(['errors' => "Body signatures[{$key}] substituted is not a boolean"]); - } - } - - foreach ($body['signatures'] as $signature) { - SignatureModel::update([ - 'set' => ['substituted' => $signature['substituted'] ? 'true' : 'false'], - 'where' => ['user_id = ?', 'id = ?'], - 'data' => [$args['id'], $signature['id']] - ]); - } - - return $response->withStatus(204); - } } diff --git a/src/frontend/app/document/document.component.ts b/src/frontend/app/document/document.component.ts index 9530292ab6cc08ce154047ec8d8d13f4bb0f297a..8adc5539a41ff320601bde20065b0cc7b39c9815 100755 --- a/src/frontend/app/document/document.component.ts +++ b/src/frontend/app/document/document.component.ts @@ -173,17 +173,6 @@ export class DocumentComponent implements OnInit { this.initDoc(); - const realUserWorkflow = this.mainDocument.workflow.filter((line: { current: boolean; }) => line.current === true)[0]; - - if (realUserWorkflow.userId !== this.authService.user.id) { - this.http.get('../rest/users/' + realUserWorkflow.userId + '/signatures') - .subscribe((dataSign: any) => { - this.signaturesService.signaturesListSubstituted = dataSign.signatures; - this.signaturesService.loadingSign = false; - }); - } else { - this.signaturesService.signaturesListSubstituted = []; - } this.docList.push({ 'id': this.mainDocument.id, 'title': this.mainDocument.title, 'pages': this.mainDocument.pages, 'imgContent': [], 'imgUrl': '../rest/documents/' + this.mainDocument.id + '/thumbnails' }); this.mainDocument.attachments.forEach((attach: any) => { this.docList.push({ 'id': attach.id, 'title': attach.title, 'pages': attach.pages, 'imgContent': [], 'imgUrl': '../rest/attachments/' + attach.id + '/thumbnails' }); diff --git a/src/frontend/app/profile/profile.component.html b/src/frontend/app/profile/profile.component.html index 146d6c83c01c606c3a3486dfc8b18e19bf79ec0e..41332627480e4cfb15046d4a839b5160c7f198d5 100644 --- a/src/frontend/app/profile/profile.component.html +++ b/src/frontend/app/profile/profile.component.html @@ -223,12 +223,6 @@ </mat-form-field> </div> </div> - <fieldset *ngIf="profileInfo.substitute != null && signaturesService.signaturesList.length > 0"> - <legend align="left">{{'lang.signSubstituted' | translate}} :</legend> - <ng-container> - <button type="button" class="signListButton" mat-stroked-button *ngFor="let signature of signaturesService.signaturesList; let i=index" (click)="toggleSignature(i)" [class.selected]="signature.substituted"><img [src]="sanitizer.bypassSecurityTrustUrl('data:image/png;base64,' + signature.encodedSignature)"/></button> - </ng-container> - </fieldset> </fieldset> </div> </div> diff --git a/src/frontend/app/profile/profile.component.scss b/src/frontend/app/profile/profile.component.scss index 472f7ecaafc563695ff3b000269a90cab1f179cb..42d57aa32beb8d93a055e3da50dd0279d66fc08c 100644 --- a/src/frontend/app/profile/profile.component.scss +++ b/src/frontend/app/profile/profile.component.scss @@ -190,16 +190,6 @@ legend { height:auto; } - -.signListButton { - margin:5px; - border: solid white; - - img { - width: 150px; - } -} - .selected { border: solid #F99830; } \ No newline at end of file diff --git a/src/frontend/app/profile/profile.component.ts b/src/frontend/app/profile/profile.component.ts index fc37a10ff54f1d3017adc1610e3d3fbcc5923bc8..d49637a3252157b6281380e6f9b3a718503bb982 100644 --- a/src/frontend/app/profile/profile.component.ts +++ b/src/frontend/app/profile/profile.component.ts @@ -420,15 +420,6 @@ export class ProfileComponent implements OnInit { this.translate.use(lang); } - toggleSignature(i: number) { - this.signaturesService.signaturesList[i].substituted = !this.signaturesService.signaturesList[i].substituted; - - this.http.patch('../rest/users/' + this.authService.user.id + '/signatures/substituted', { 'signatures': this.signaturesService.signaturesList }) - .subscribe((data: any) => { - this.notificationService.success('lang.modificationSaved'); - }); - } - refreshUserList(opened: any) { if (opened) { this.http.get('../rest/users') diff --git a/src/frontend/app/service/signatures.service.ts b/src/frontend/app/service/signatures.service.ts index 71d30a0198dd8ac9d7727889161c8d54189dca71..51110434aee74d5e5f1499ec2bb409645b31e48d 100755 --- a/src/frontend/app/service/signatures.service.ts +++ b/src/frontend/app/service/signatures.service.ts @@ -7,7 +7,6 @@ export class SignaturesContentService { signaturesContent: any[] = []; notesContent: any[] = []; signaturesList: any[] = []; - signaturesListSubstituted: any[] = []; currentPage = 1; totalPage = 1; isTaggable = true; @@ -63,7 +62,6 @@ export class SignaturesContentService { this.signaturesContent = []; this.notesContent = []; this.signaturesList = []; - this.signaturesListSubstituted = []; this.currentPage = 1; this.totalPage = 1; this.isTaggable = true; diff --git a/src/frontend/app/signatures/signatures.component.html b/src/frontend/app/signatures/signatures.component.html index 6d5d45ffd6b5aee0555a9eb12721e4a0fa34eaca..d0f7aa2e0106a1b1988fb2e456163a382c1c50e9 100755 --- a/src/frontend/app/signatures/signatures.component.html +++ b/src/frontend/app/signatures/signatures.component.html @@ -12,13 +12,6 @@ <i class="fas fa-pen-nib fa-2x"></i> {{'lang.createNewSignature' | translate}} </div> - <div [@listAnimation]="signaturesService.signaturesListSubstituted.length" style="display: contents;"> - <div *ngFor="let signature of signaturesService.signaturesListSubstituted;let i=index" class="list-item" style="position: relative;overflow: hidden" (tap)="tapEvent(signature,i,'substitute')"> - <img [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + signature.encodedSignature)" - style="width: 190px;"> - <div class="substituteInfo">{{'lang.substitutedSignature' | translate}}</div> - </div> - </div> <div [@listAnimation]="signaturesService.signaturesList.length" style="display: contents;"> <div *ngFor="let signature of signaturesService.signaturesList;let i=index" class="list-item" style="position: relative;overflow: hidden" (tap)="tapEvent(signature,i,'')"> <span class="remove_icon_{{i}}" style="display:none;position: absolute;top: 5px;left: 5px;" (tap)="removeSignature(signature,i);"><i style="border-radius: 25px;background: white;left:0px;top:0px;color:red;font-size: 50px;" class="fa fa-times-circle fa-2x"></i></span> diff --git a/src/frontend/app/signatures/signatures.component.scss b/src/frontend/app/signatures/signatures.component.scss index e6ff4efe14a050d97f5ecc5c93b97a88c66c51c9..4e4d194cfebbb10f971b5e1a3eb02a15316dc1b4 100644 --- a/src/frontend/app/signatures/signatures.component.scss +++ b/src/frontend/app/signatures/signatures.component.scss @@ -33,13 +33,6 @@ display: flex; justify-content: center; align-items: center; - .substituteInfo { - color: #F99830; - font-size: 10px; - position: absolute; - top: 0px; - right: 10px; - } &.create { background-color: #F1F4F4; flex-direction: column; diff --git a/src/frontend/app/signatures/signatures.component.ts b/src/frontend/app/signatures/signatures.component.ts index 79b2dc82222b30514938599cf38a6772492769d6..2e158a8c21412298a92e22d56368e89b9343943d 100755 --- a/src/frontend/app/signatures/signatures.component.ts +++ b/src/frontend/app/signatures/signatures.component.ts @@ -62,8 +62,7 @@ export class SignaturesComponent implements OnInit { this.signaturesService.signaturesList.unshift( { id: this.signaturesService.newSign.id, - encodedSignature: this.signaturesService.newSign.encodedSignature, - substituted: false + encodedSignature: this.signaturesService.newSign.encodedSignature } ); this.signaturesService.newSign = {};