Skip to content

[Candidate Identifier (Rework Part 2)] Domain Models and Identifier Logic - #11212

Open
HachemJ wants to merge 1 commit into
aces:mainfrom
HachemJ:ReworkCandidateIdentifiers
Open

HachemJ wants to merge 1 commit into
aces:mainfrom
HachemJ:ReworkCandidateIdentifiers

Conversation

@HachemJ

@HachemJ HachemJ commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Brief summary of changes

This PR adds the models, controllers, and identifier generation logic for the candidate identifier rework.

It allows LORIS to manage multiple identifier types, each with their own format, validation rules, uniqueness settings, and project associations.

This PR depends on #11209.

Changes

  • Added models for identifier types and candidate identifier values, including their configuration and project associations.
  • Added controllers to manage identifier types and their project associations.
  • Added support for creating, retrieving, updating, and deleting candidate identifier values.
  • Added validation against configured identifier formats, including uniqueness checks and restrictions on multiple values of the same type.
  • Added identifier generation using sequential or random values, with support for numeric and alphabetic formats, prefixes, padding, and minimum and maximum values.
  • Updated the existing identifier generator to support configurable padding.
  • Added unit tests for identifier type management, candidate identifier operations, and identifier generation. Updated existing identifier tests to account for the format changes.

Testing Instructions

  1. Run the unit tests for IdentifierTypeController, CandidateIdentifierController, and CandidateIdentifierGenerator:

    LORIS_DB_CONFIG=/path/to/credentials \
    vendor/bin/phpunit --bootstrap test/bootstrap.php \
    test/unittests/IdentifierTypeControllerTest.php
    LORIS_DB_CONFIG=/path/to/credentials \
    vendor/bin/phpunit --bootstrap test/bootstrap.php \
    test/unittests/CandidateIdentifierControllerTest.php
    LORIS_DB_CONFIG=/path/to/credentials \
    vendor/bin/phpunit --bootstrap test/bootstrap.php \
    test/unittests/CandidateIdentifierGeneratorTest.php
  2. Verify that identifier types and their project associations can be retrieved correctly.

  3. Check that identifiers can be created, retrieved, updated, and deleted through CandidateIdentifierController.

  4. Verify that identifier values are validated against their configured formats.

  5. Check that duplicate values are rejected for identifier types marked as unique.

  6. Verify that multiple values of the same type are only allowed when AllowMultiple is enabled.

  7. Test sequential and random identifier generation with different formats, prefixes, padding, and minimum and maximum values.

  8. Run the existing identifier tests to check that the changes do not break the previous functionality.

@github-actions github-actions Bot added the Language: SQL PR or issue that update SQL code label Sep 22, 2026
@HachemJ
HachemJ force-pushed the ReworkCandidateIdentifiers branch from cb0c78e to 649dd44 Compare September 24, 2026 16:24
@driusan

driusan commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

An identifier type can have at most one permission, and a permission can only be associated with one identifier type. [..]

What is the reasoning for this?

I get that one permission makes it easier to implement which makes sense, but if that's a permanent design decision then why have a separate rel table instead of just a column in the identifier type table to list the one permission?

As for a permission only being allowed to be associated with one identifier type.. why? Multiple different related identifier types having the same permission seems reasonable and I can't think of any way that adding this restriction would simplify the implementation.

@HachemJ

HachemJ commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

An identifier type can have at most one permission, and a permission can only be associated with one identifier type. [..]

What is the reasoning for this?

I get that one permission makes it easier to implement which makes sense, but if that's a permanent design decision then why have a separate rel table instead of just a column in the identifier type table to list the one permission?

As for a permission only being allowed to be associated with one identifier type.. why? Multiple different related identifier types having the same permission seems reasonable and I can't think of any way that adding this restriction would simplify the implementation.

Yes, thank you for bringing it up. What I meant is that an identifier type can have at most one permission, but the same permission can be used by multiple identifier types.

With that relationship, I think your point about the separate relation table makes sense too. Since it’s many to one, permID could just be a nullable foreign key on the identifier type table. The relation table would only really be needed if we wanted multiple permissions per identifier type later.

@github-actions github-actions Bot added the Language: PHP PR or issue that update PHP code label Sep 25, 2026
@HachemJ
HachemJ force-pushed the ReworkCandidateIdentifiers branch from a617af0 to 93e2302 Compare September 30, 2026 19:10
@HachemJ HachemJ added the State: Blocked PR or issue awaiting an external event such as the merge or another PR to proceed label Oct 7, 2026
@github-actions github-actions Bot added the Module: api PR or issue related to api module label Oct 8, 2026
@HachemJ HachemJ changed the title Add candidate identifier tables [Candidate Identifiers] Introduce configurable candidate identifier framework Oct 9, 2026
@HachemJ
HachemJ force-pushed the ReworkCandidateIdentifiers branch from b029f3e to 2d7b64d Compare October 12, 2026 23:25
@HachemJ HachemJ changed the title [Candidate Identifiers] Introduce configurable candidate identifier framework [Candidate Identifier Rework] Domain Models and Identifier Logic Oct 14, 2026
@github-actions github-actions Bot added the Module: new_profile PR or issue related to new_profile module label Oct 16, 2026
@HachemJ HachemJ changed the title [Candidate Identifier Rework] Domain Models and Identifier Logic [Candidate Identifier (Rework)] Domain Models and Identifier Logic Oct 16, 2026
@HachemJ
HachemJ marked this pull request as ready for review October 19, 2026 18:43
@HachemJ HachemJ added the State: Blocking PR should be prioritized because it is blocking the progress of another task label Oct 22, 2026
@HachemJ
HachemJ force-pushed the ReworkCandidateIdentifiers branch 2 times, most recently from ccccd57 to e24e671 Compare October 27, 2026 15:21
@HachemJ HachemJ changed the title [Candidate Identifier (Rework)] Domain Models and Identifier Logic [Candidate Identifier (Rework Part 2)] Domain Models and Identifier Logic Nov 3, 2026
@HachemJ
HachemJ force-pushed the ReworkCandidateIdentifiers branch from bd10df2 to 77c473b Compare November 3, 2026 14:41
@HachemJ
HachemJ force-pushed the ReworkCandidateIdentifiers branch 5 times, most recently from 065758a to 907bd33 Compare November 18, 2026 16:47
@HachemJ
HachemJ force-pushed the ReworkCandidateIdentifiers branch 2 times, most recently from 155e719 to 20b169d Compare November 19, 2026 15:36
@HachemJ HachemJ removed the State: Blocked PR or issue awaiting an external event such as the merge or another PR to proceed label Nov 19, 2026
@HachemJ
HachemJ force-pushed the ReworkCandidateIdentifiers branch 2 times, most recently from a0ead00 to ab37403 Compare November 20, 2026 20:04
@HachemJ
HachemJ force-pushed the ReworkCandidateIdentifiers branch from ab37403 to 1a2010a Compare November 20, 2026 20:45

This branch has not been deployed

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

Labels

Language: PHP PR or issue that update PHP code Language: SQL PR or issue that update SQL code Module: api PR or issue related to api module Module: new_profile PR or issue related to new_profile module State: Blocking PR should be prioritized because it is blocking the progress of another task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants