Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug #12685 : hide _sps field when having one value #1900

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

IsmailHam87
Copy link
Collaborator

Description

Description des modifications

Type de changement

Indiquer le ou les types de changements

  • Build
  • PKI
  • Ansiblerie
  • Nouveau Code
  • Correction
  • Refactorisation de code
  • Autre

Documentation

Indiquer la documentation mise à jour

  • Quels sont les nouvelles documentations ?
  • Quels sont les modifications existantes ?
  • Quels sont les documentations ou sections de documentations supprimés ?

Tests

Indiquer comment le code à été testé (manuel, environnement, TU, etc)

  • manuel
  • environnement
  • TU

Migration

Indiquer si les modifications apportées impliquent une migration sur l'existant et comment la faire

Checklist

Sélectionner les éléments de la checklist

  • Mon code suit le style de code de ce projet.
  • J'ai commenté mon code, en particulier dans les classes et les méthodes difficile à comprendre.
  • J'ai fait les changements correspondant dans la documentation RAML.
  • J'ai fait les changements correspondant dans la documentation Métier.
  • J'ai fait les changements correspondant dans la documentation Technique.
  • J'ai rajouté les tests unitaires vérifiant mes fonctionnalités.
  • J'ai rajouté les tests de non régression vérifiant mes fonctionnalités.
  • Les tests unitaires nouveaux et existants passent avec succès localement.
  • Toutes les dépendances ont été mergées en priorité

Contributeur

Indiquer qui a développé cette fonctionnalité

  • VAS (Vitam Accessible en Service)
  • CEA (Commissariat à l'énergie atomique et aux énergies alternatives)

@vitam-devops
Copy link
Collaborator

vitam-devops commented Jun 13, 2024

Logo
Checkmarx One – Scan Summary & Details29e7d501-d55d-4ecb-ac7b-97cf44c3626d

New Issues

Severity Issue Source File / Package Checkmarx Insight
HIGH CVE-2019-15599 Npm-tree-kill-1.2.1 Vulnerable Package
HIGH CVE-2020-28502 Npm-xmlhttprequest-ssl-1.5.5 Vulnerable Package
HIGH CVE-2020-36048 Npm-engine.io-3.2.1 Vulnerable Package
HIGH CVE-2020-36049 Npm-socket.io-parser-3.2.0 Vulnerable Package
HIGH CVE-2020-7660 Npm-serialize-javascript-1.9.1 Vulnerable Package
HIGH CVE-2020-7788 Npm-ini-1.3.5 Vulnerable Package
HIGH CVE-2021-31597 Npm-xmlhttprequest-ssl-1.5.5 Vulnerable Package
HIGH CVE-2022-2421 Npm-socket.io-parser-3.2.0 Vulnerable Package
HIGH CVE-2023-45133 Npm-babel-traverse-6.26.0 Vulnerable Package
MEDIUM CVE-2019-16769 Npm-serialize-javascript-1.9.1 Vulnerable Package
MEDIUM CVE-2020-15366 Npm-ajv-6.10.0 Vulnerable Package
MEDIUM CVE-2020-15366 Npm-ajv-5.5.2 Vulnerable Package
MEDIUM CVE-2020-28481 Npm-socket.io-2.1.1 Vulnerable Package
MEDIUM CVE-2020-7693 Npm-sockjs-0.3.19 Vulnerable Package
MEDIUM CVE-2021-23364 Npm-browserslist-4.5.5 Vulnerable Package
MEDIUM CVE-2022-21704 Npm-log4js-4.5.1 Vulnerable Package
MEDIUM CVE-2022-41940 Npm-engine.io-3.2.1 Vulnerable Package
LOW Logging of Sensitive Data /ansible.cfg: [2](https://github.com/ProgrammeVitam/vitam-ui/blob/bugs-#12685-hide-_sps-field-with-one-value//deployment/pki/scripts/lib/ansible.cfg# L2) To keep sensitive values out of logs, tasks that expose them need to be marked defining 'no_log' and setting to True
LOW Logging of Sensitive Data /ansible.cfg: [2](https://github.com/ProgrammeVitam/vitam-ui/blob/bugs-#12685-hide-_sps-field-with-one-value//tools/docker/mongo/ansible.cfg# L2) To keep sensitive values out of logs, tasks that expose them need to be marked defining 'no_log' and setting to True
LOW Logging of Sensitive Data /ansible.cfg: [1](https://github.com/ProgrammeVitam/vitam-ui/blob/bugs-#12685-hide-_sps-field-with-one-value//deployment/ansible.cfg# L1) To keep sensitive values out of logs, tasks that expose them need to be marked defining 'no_log' and setting to True

@GiooDev GiooDev added this to the IT 137 milestone Jun 13, 2024
 - after review changes were made to modify the _sps field only
@IsmailHam87 IsmailHam87 merged commit b739ae0 into develop Jun 14, 2024
9 checks passed
@IsmailHam87 IsmailHam87 deleted the bugs-#12685-hide-_sps-field-with-one-value branch June 14, 2024 13:13
@@ -132,6 +132,16 @@ export class ArchiveUnitEditObjectService {
displayObject.children.forEach((child) => this.hideLabellessDisplayObjects(child));
}

public hideSpsFieldWithOneValue(displayObject: DisplayObject): void {
const hasOneValue = Boolean(displayObject.displayRule.ui.Path === '#originating_agencies' && displayObject.value.length === 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IsmailHam87 Pourquoi mettre Boolean(...) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

car dans le cas où il y a plusieurs valeurs, celles-ci devrait s'afficher.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce que je veux dire, c'est qu'on pourrait très bien écrire : const hasOneValue = displayObject.displayRule.ui.Path === '#originating_agencies' && displayObject.value.length === 1;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah d'accord, je peux l'adapter, est ce que c'est mieux côté perf ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si ça marche, on peut laisser je pense. Mais c'est surtout que j'ai jamais vu cette manière d'écrire le code et que ça ajoute du code pour rien. L'expression étant déjà un booléen, il n'y a pas de raison d'essayer de la convertir en booléen.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est vrai j'ai pas fait attention qu'il fait juste le cast, je vais corriger..

displayObject.displayRule = { ...displayObject.displayRule, ui: { ...displayObject.displayRule.ui, display: false } };
}

displayObject.children.forEach((child) => this.hideSpsFieldWithOneValue(child));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IsmailHam87 A-t-on besoin de parcourir toute l'arborescence ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oui car il faut éviter quelques effets de bords sur d'autres champs autre que _sps

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il me semblait que le _sps était à la racine et qu'il n'était pas nécessaire d'avoir du code récursif. Mais bon, ça devrait marcher, c'est juste qu'on perds peut-être juste du temps à parcourir toute l'arborescence pour rien.

@IsmailHam87 IsmailHam87 restored the bugs-#12685-hide-_sps-field-with-one-value branch June 17, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants