Skip to content

[IMPROVEMENT] 48597: cmi5/xAPI: use ILIAS\Data\UUID instead of ramsey/uuid directly - #12270

Open
chfsx wants to merge 2 commits into
ILIAS-eLearning:trunkfrom
srsolutionsag:improvement/12/48597-cmixapi-data-uuid
Open

chfsx wants to merge 2 commits into
ILIAS-eLearning:trunkfrom
srsolutionsag:improvement/12/48597-cmixapi-data-uuid

Conversation

@chfsx

@chfsx chfsx commented Oct 23, 2026

Copy link
Copy Markdown
Member

Implements https://mantis.ilias.de/view.php?id=48597: cmi5/xAPI was the only component using ramsey/uuid directly instead of ILIAS\Data\UUID\Factory, and four public methods of ilCmiXapiUser returned \Ramsey\Uuid\UuidInterface. After this PR ramsey/uuid is only used by the Data component. Same approach as #12266, #12267, #12268 and #12269.

Data

  • ILIAS\Data\UUID\Factory::uuid3() / uuid3AsString(): name-based UUIDs (version 3). The namespace can be a Uuid or a string, with or without hyphens (cmi5/xAPI stores its namespace ilias_uuid either way).
  • A test pins the results for fixed namespaces and names; the expected values are cross-checked with Python's uuid.uuid3(), so the test does not just mirror the current library.

cmi5/xAPI

  • ilCmiXapiUser::generateCMI5Registration(), generateRegistration(), getCMI5RegistrationFromAuthToken() and getRegistrationFromAuthToken() use the Data factory and return ILIAS\Data\UUID\Uuid. All callers only use the value as a string ((string) casts, comparison with the registration parameter, launch parameters); Uuid has __toString().
  • ilCmiXapiAuthToken::createToken() uses uuid4AsString(), ilCmiXapiContentUploadImporter builds the activity ID with uuid3AsString().
  • The commented-out ramsey line in ilCmiXapiUser::getIliasUuid() is removed.

The registrations and activity IDs are stored in and compared against the LRS, so they must not change: with the ilias_uuid of a real installation and with a namespace without hyphens, the Data factory returns exactly the values ramsey returned before (checked for several object/user combinations).

Testing

  • Build: [OK] All static artifacts are build!
  • PHPUnit, whole suite: green except RootFolderTest, which only fails locally because of untracked files in the root folder of my checkout. Data and CmiXapi tests pass.
  • Code rules gate on components/ILIAS: green. php-cs-fixer on the changed files: clean.
  • On a trunk installation, in the browser: LRS type and xAPI standard object (resource URL) created and launched. The launch URL carries registration=14f0094e-2f3f-3b13-8901-90ef2936ea48, which is uuid3(ilias_uuid, "<ref_id>-<usr_id>") as computed independently; the auth token for the xAPI proxy is created as before. Not tested: cmi5 packages and statements against a real LRS.

@Uwe-Kohnle for cmi5/xAPI, @lscharmer @mjansenDatabay for Data.

If there are no objections, I will merge this before Coding Completed.

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.

1 participant