OpenSlides / openslides-client

Webclient for OpenSlides 4+
MIT License
3 stars 33 forks source link

Saml attribute mapping cut off #4378

Open hjanott opened 2 days ago

hjanott commented 2 days ago

Describe the bug When displaying a saml attribute mapping that contains an empty string inside a nested object like the following, the mapping is cut off after the nested object with ":" and the string is filled with random characters fe. "}],".

    "meeting_mappers": [
        {
            "external_id": "M2025",
            "mappings": {
                "structure_levels": [
                    {
                        "default": ""
                    }
                ],

How to Reproduce Steps to reproduce the behavior:

  1. Login as superadmin.
  2. Go to orga settings.
  3. Save a saml attribute mapping that follows the rules of backend PR and contains an empty string like above.
  4. Reload the orga settings.

Expected behavior The full attribut mapping should be displayed correctly.

Additional context You need to have at least backend PR 2722 or a branch containing this PR to be able to save the mapping.

hjanott commented 1 day ago

Example attribute mapping.

{
   "email": "email",
   "title": "title",
   "gender": "gender",
   "pronoun": "pronoun",
   "saml_id": "username",
   "is_active": "is_active",
   "last_name": "lastName",
   "first_name": "firstName",
   "member_number": "member_number",
   "meeting_mappers": [
      {
         "name": "works",
         "mappings": {
            "groups": [
               {
                  "default": "not_a_group",
                  "attribute": "idp_group_attribute"
               },
               {
                  "default": "not_a_group",
                  "attribute": "group_2"
               }
            ],
            "number": {
               "attribute": "participant_number"
            },
            "comment": {
               "default": "Vote weight, groups and structure levels set via SSO.",
               "attribute": "idp_commentary"
            },
            "present": {
               "default": "True",
               "attribute": "presence"
            },
            "vote_weight": {
               "default": "1.000000",
               "attribute": "vw"
            },
            "structure_levels": [
               {
                  "default": "structure1",
                  "attribute": "structure"
               }
            ]
         },
         "conditions": [
            {
               "attribute": "member_number",
               "condition": "LV_.*"
            },
            {
               "attribute": "email",
               "condition": "[\\w\\.]+@([\\w-]+\\.)+[\\w]{2,4}"
            }
         ],
         "external_id": "Landtag"
      },
      {
         "name": "meetingHH-Test",
         "mappings": {
            "groups": [
               {
                  "default": "Defaultgroup",
                  "attribute": "idp_group_attribute"
               }
            ],
            "number": {
               "attribute": "participant_number"
            },
            "comment": {
               "default": "Vote weight, groups and structure levels set via SSO.",
               "attribute": "idp_commentary"
            },
            "present": {
               "default": "True",
               "attribute": "presence"
            },
            "structure_levels": [
               {
                  "default": "structure1",
                  "attribute": "structure"
               }
            ]
         },
         "conditions": [
            {
               "attribute": "member_number",
               "condition": "11600.*"
            },
            {
               "attribute": "email",
               "condition": "[\\w\\.]+@([\\w-]+\\.)+[\\w]{2,4}"
            }
         ],
         "external_id": "meetingHH"
      },
      {
         "name": "meetingHH-Test-Gaeste",
         "mappings": {
         },
         "conditions": [
            {
               "attribute": "member_number",
               "condition": "^(?!11600).*"
            }
         ],
         "external_id": "Landtag"
      }
   ],
   "is_physical_person": "is_person"
}
reiterl commented 9 hours ago

The failure seems to be in the objectToFormattedString() function. One regex breaks the display.