Skip to content

Test10 45372-2: Fix participant names after user import - #11514

Open
matheuszych wants to merge 1 commit into
ILIAS-eLearning:release_10from
matheuszych:ta10/45372-2
Open

matheuszych wants to merge 1 commit into
ILIAS-eLearning:release_10from
matheuszych:ta10/45372-2

Conversation

@matheuszych

Copy link
Copy Markdown
Contributor

See: https://mantis.ilias.de/view.php?id=45372

After importing test users to another system, attempts kept the anonymous user ID while participant metadata still carried the real names. Views used global user lookups or generic anonymous labels, so names appeared wrong even when the test was not anonymous. Result and scoring GUIs, the participant list, manual scoring tables, and the toplist now resolve labels via ParticipantRepository::getParticipantByActiveId and getDisplayName so imported participants display correctly.

/cc @thojou

@dsstrassner

Copy link
Copy Markdown
Contributor

hi @kergomard please have a look!

@dsstrassner dsstrassner added bugfix php Pull requests that update Php code labels May 4, 2026

@kergomard kergomard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you very much for the PR @matheuszych

I've a more general request:

  • I've the impression that during the last few weeks I've come across a too big number of PRs somehow changing the behavior of how names are displayed. Please collect all places where we are presenting the names of participants, try to classify them by their requirements (there might be special requirements,e.g. in the scoring view where people only having access through the permission to score anonymously should never see names and try to find a general solution that centralizes the generation of the names as much as possible. I completely lost the overview and I think the flood of individual changes is a really bad sign.

Please make the following changes:

  • Please to not introduce a use of TestDIC in ilTestEvaluationGUI, ilTestParticipantList and TestScoringByParticipantGUI, but inject the ParticipantRepository.
  • Please move the parameter $participant_repository above $objective_parent in the constructor of ilTestResultsGUI.
  • Please move the parameter $participant_repository above $lng in the constructor of DataRetrieval

Thanks again and best,
@kergomard

@matheuszych

Copy link
Copy Markdown
Contributor Author

Hello @kergomard ,

Thank you for your feedback.

I moved the $participant_repository references accordingly.
Regarding your request, I’ll take a look at it later and get back to you.

Best regards
@matheuszych

@kergomard

Copy link
Copy Markdown
Contributor

Just for clarification: I will merge this request once we know more about all other places in order to not be changing things around all willy-nilly.

Best,
@kergomard

@matheuszych

Copy link
Copy Markdown
Contributor Author

Hello @kergomard ,

i reviewed a test and identified several places where personal user data might be displayed. I can’t guarantee that there are no additional locations I haven’t found. Some areas behave as intended and show “Anonymous” instead of real names, but others still reveal personal data and should be reviewed.

Works as intended

  • Questions → any question → “Print Answers”
    Participant name is shown for non-anonymous tests; anonymous tests are handled correctly.

  • Participants → Participants (table)
    Behavior matches expectations for anonymous vs. non-anonymous tests.

  • Participants → “Export data” → “Scored Test Attempt” / “All test attempts”
    These exports do not contain participant data and behave as expected.

  • Participants → “Show Results”

    • Non-anonymous tests: “Results of Test Attempt 1 for <full_user_name>”.
    • Anonymous tests: “List of Answers for Attempt 1”.
      The “Print” view reflects the same behavior.
  • Manual Scoring → Scoring by Question (table)
    Shows the full username for non-anonymous tests; hides it for anonymous tests.

  • Manual Scoring → Scoring by Question → “Grade” (modal)
    The participant’s username is displayed/hidden correctly depending on anonymity.

  • Manual Scoring → Scoring by Participant (table)

    • Anonymous tests: only a “Name” column with all values “anonymous”.
    • Non-anonymous tests: “Last Name”, “First Name”, and “Login” with correct values.
  • Manual Scoring → Scoring by Participant → “Edit Scoring”
    Shows either “Test Attempts for Participant: Anonymous” (anonymous tests) or
    “Test Attempts for Participant: <full_user_name>” (non-anonymous tests), as intended.

  • Exports “as XML (incl. Participant Results)” and “as XML”
    Both exports behave as expected with respect to participant data.

Possibly an issue

  • Certificate Settings / Certificate generation
    Certificate templates use placeholders for participant data. It is unclear whether certificates can be generated for anonymous participants in a way that reveals their identity. This should be verified, as it may allow access to participant data for anonymous tests.

  • Participants → “Export data” → “as Certificate (PDF)”
    When no certificate is available, a message can appear:
    “The following account did not achieve a certificate, or the certificate service is not enabled/activate: root”
    In anonymous tests, this message should not expose logins or other identifying data.

  • Participants → Participants (table) → Login Filter
    Even when real names are hidden in anonymous tests, it is still possible to filter by login. If the logins are known, this effectively allows identification of participants. The login filter should likely be disabled or adjusted for anonymous tests.

  • Export “as Archive File”
    The username is used as part of a filename inside the archive, which can reveal participant identities in anonymous tests. This should be changed so that no identifying data appears in filenames for anonymous tests.

    Best regards
    @matheuszych

@kergomard

Copy link
Copy Markdown
Contributor

Thank you very much @matheuszych !

This helps a lot and I think we should tackle these issues, I will have a look at the "possibly an issue" cases myself once we have merged this.

I now fought a while with this and I do think we need to change one thing:

  • We will need to find a better way of retrieving the participant information. In the changed places we are displaying lists of participants and on each participant we are triggering a database roundtrip with a complex query and then building an object out of it. And all this because we need four things: A login, a first name, a last name, and an import name. I do not think we can do that, this is far too expensive. Currently I think we should split out a ILIAS\Test\Partcipants\User from ILIAS\Test\Partcipants\Participant and give it the properties user_id importname, firstname, lastname, login, and matriculation. We would then inject that into ILIAS\Test\Partcipants\Participant. I would suggest to move the getters to it and to change the corresponding calls to ->getUser()->get<Value>(). We should then finally provide a function on ILIAS\Test\Participants\ParticipantRepository to retrieve only the user and to retrieve it for multiple active_ids. What do you think?

Then a nit-pick:

On a side-note:
I've just added the importname to the query for ILIAS 10 with 390b4db to get this out of the way.

Sorry, I only realized this during my second read-through and thanks again,
@kergomard

@matheuszych

Copy link
Copy Markdown
Contributor Author

Hello @kergomard ,

thank you again for your feedback!

I implemented the suggested changes. Please take a look again.

Best regards
@matheuszych

@dsstrassner

Copy link
Copy Markdown
Contributor

@kergomard will you look into this PR before your absence, or should @thojou take over?

@kergomard kergomard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you very much @matheuszych for the update and sorry it took me so long to look at this!

This looks nice now as far as I can see there is only one very small thing:

  • I think we should stick to the pattern and make ParticipantRepository::getUsersByActiveIds() return a \Generator. This might not be what you actually need right there, but it would make the interface more consistent

Could you then please rebase, squash, and give it a final test and then @thojou could merge and pick? This would be very kind!

Thank you very much again and best,
@kergomard

See: https://mantis.ilias.de/view.php?id=45372

After importing test users to another system, participant rows could still
show wrong names because views used global user lookups or generic anonymous
labels instead of test-local metadata. Resolving names via
`getParticipantByActiveId()` per row also duplicated heavy participant queries
in lists and tables.

Introduced `ILIAS\Test\Participants\User` with identity fields and
`getDisplayName()`, wired it through `Participant`, and added
`ParticipantRepository::getUsersByActiveIds()` as a lightweight batched
lookup against `tst_active` and `usr_data`. The method returns a
`\Generator` keyed by active id, consistent with `getParticipants()`. Updated
evaluation, toplist, manual scoring, and participant list call sites to
batch-fetch users and use `getUser()` for user-facing data.
@matheuszych

matheuszych commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Hello @kergomard ,
thank you again for your feedback! I changed the method to be a generator and adjusted all of its usages.

Best regards
@matheuszych

@dsstrassner

Copy link
Copy Markdown
Contributor

@thojou was ist dein Plan mit diesem und den verlinkten PRs? Auf Rückmeldung von @kergomard warten oder demnächst mergen? Und falls mergen: wann genau?

Kommentar gilt auch für #12449 / #12450 / #12451

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants