Skip to content

[Candidate Identifier (Rework Part 6)] Add Candidate Identifiers Widget - #11288

Open
HachemJ wants to merge 5 commits into
aces:mainfrom
HachemJ:AddCandidateIdentifiersWidget
Open

HachemJ wants to merge 5 commits into
aces:mainfrom
HachemJ:AddCandidateIdentifiersWidget

Conversation

@HachemJ

@HachemJ HachemJ commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Brief summary of changes

This PR adds a Candidate Identifiers widget to the candidate dashboard, allowing users to view a candidate's identifiers directly from their profile.

This PR depends on #11279.

Changes

  • Added a Candidate Identifiers widget to the candidate dashboard.
  • Added a read-only table displaying identifier types and their corresponding values.
  • Added a "No identifiers found" message when the candidate has no visible identifiers.
  • Added permission checks to ensure users only see identifier types they are authorized to access.
  • Added project access checks to ensure identifiers are only displayed to users with the appropriate project access.
Candidate Identifiers widget

Testing Instructions

Widget functionality

  1. Open a candidate profile and verify that the Candidate Identifiers widget appears on the dashboard.
  2. Verify that the widget displays the correct identifier types and values.
  3. Open a candidate profile with no visible identifiers and verify that the widget displays "No identifiers found".
  4. Verify that the widget is read-only and does not provide options to add, edit, or delete identifiers.
  5. Log in with a non-admin user who has access to candidate profiles and verify that the widget is visible.
  6. Verify that the widget is correctly translated in English and French.

Permission restrictions

The following SQL commands use ExternalID (identifier type ID 2), user ID 1, and the edit_policies permission (permission ID 94) as examples. Adjust these IDs according to your local raisinbread test database if needed.

  1. Assign a required permission to ExternalID:

    UPDATE candidate_identifier_types
    SET permID = 94
    WHERE CandidateIdentifierTypeID = 2;
  2. Ensure the test user does not have the required permission or superuser permission:

    DELETE FROM user_perm_rel
    WHERE userID = 1 AND permID IN (1, 94);

    Note: Superusers bypass individual permission checks.

  3. Log out and log back in. Open a candidate profile containing an ExternalID and verify that it is no longer displayed.

  4. Verify that identifiers without additional permission restrictions remain visible.

  5. Grant the required permission to the test user:

    INSERT INTO user_perm_rel (userID, permID)
    VALUES (1, 94);
  6. Log out and log back in. Verify that ExternalID is displayed again.

Project restrictions

The following example assumes that the candidate belongs to project 1 and that the test user has access to that project.

  1. Restrict ExternalID to a different project:

    INSERT INTO candidate_identifier_types_project_rel
        (CandidateIdentifierTypeID, ProjectID)
    VALUES (2, 2);
  2. Refresh the candidate profile and verify that ExternalID is not displayed.

  3. Change the restriction to match the candidate's project:

    UPDATE candidate_identifier_types_project_rel
    SET ProjectID = 1
    WHERE CandidateIdentifierTypeID = 2 AND ProjectID = 2;
  4. Refresh the candidate profile and verify that ExternalID is displayed again.

  5. Verify that users without access to the required project cannot view the restricted identifier.

API regression testing

Verify that the candidate identifiers API continues to enforce the same permission and project restrictions when viewing, adding, editing, and deleting identifiers.

@HachemJ HachemJ added the State: Blocked PR or issue awaiting an external event such as the merge or another PR to proceed label Nov 4, 2026
@github-actions github-actions Bot added Language: SQL PR or issue that update SQL code Language: PHP PR or issue that update PHP code Language: Javascript PR or issue that update Javascript code Module: api PR or issue related to api module Module: configuration PR or issue related to configuration module Module: new_profile PR or issue related to new_profile module Multilingual Any tasks related to making LORIS multilingual and removed State: Blocked PR or issue awaiting an external event such as the merge or another PR to proceed labels Nov 4, 2026
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersWidget branch from 056dc89 to 171657a Compare November 4, 2026 19:17
@HachemJ HachemJ added the State: Blocked PR or issue awaiting an external event such as the merge or another PR to proceed label Nov 4, 2026
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersWidget branch from 171657a to afcb88c Compare November 4, 2026 21:38
@HachemJ HachemJ added the State: Blocking PR should be prioritized because it is blocking the progress of another task label Nov 6, 2026
@HachemJ
HachemJ marked this pull request as ready for review November 10, 2026 16:19
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersWidget branch 4 times, most recently from 418c4fb to 00fdc6d Compare November 19, 2026 19:55

@HenriRabalais HenriRabalais left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@HachemJ

just one comment inline about the access check. Same as on Part 5, could the widget be a .tsx function component?

foreach ($identifiers as $identifier) {
$identifierType = $identifier->type;

// Check project restrictions.

@HenriRabalais HenriRabalais Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this project and permission check is the same as _canAccessIdentifierType in the identifiers API endpoint, could it live in one place? Say a method on IdentifierType or IdentifierTypeController that both call

@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersWidget branch from 00fdc6d to b9ae870 Compare November 24, 2026 18:41
@HachemJ

HachemJ commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review on Part 6 (Candidate Identifiers Widget), Henri!

I've addressed your comments:

  • Centralized the identifier type permission and project checks in IdentifierTypeController, so both the widget and the candidate identifiers API reuse the same authorization logic.
  • Converted the widget to a TypeScript functional component .tsx.
  • Extended the existing Candidate Identifiers test plan with a dedicated widget testing section, following the same structure as the Candidate Parameters module.
  • Updated the PR description with more detailed testing instructions, including SQL queries to test permission and project restrictions.

Ready for another review. Thanks!

@HenriRabalais HenriRabalais left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@HachemJ

thanks for moving the check into IdentifierTypeController! looks good to me 🙂

@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersWidget branch from b9ae870 to bcae070 Compare November 26, 2026 16:02
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersWidget branch from bcae070 to 3a2891d Compare November 27, 2026 19:32
@HachemJ

HachemJ commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

The last force push is to rebase onto the latest version of Part 5.

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: Javascript PR or issue that update Javascript code 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: configuration PR or issue related to configuration module Module: new_profile PR or issue related to new_profile module Multilingual Any tasks related to making LORIS multilingual State: Blocked PR or issue awaiting an external event such as the merge or another PR to proceed 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.

2 participants