Skip to content

[Candidate Identifier (Rework Part 5)] Add Candidate Identifiers Module - #11279

Open
HachemJ wants to merge 4 commits into
aces:mainfrom
HachemJ:AddCandidateIdentifiersModule
Open

HachemJ wants to merge 4 commits into
aces:mainfrom
HachemJ:AddCandidateIdentifiersModule

Conversation

@HachemJ

@HachemJ HachemJ commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Brief summary of changes

This PR adds a Candidate Identifiers module for viewing and managing identifiers associated with candidates.

The module provides a filterable table and allows users to add, edit, and delete identifiers while respecting identifier permissions and project restrictions.

This PR depends on #11261.

Changes

  • Added a Candidate Identifiers module following the existing LORIS data framework and table conventions.
  • Added a filterable table displaying CandID, PSCID, identifier type, identifier value, and dates added and edited.
  • Added support for creating identifiers with manually entered or automatically generated values.
  • Added support for editing existing identifiers, while preventing PSCIDs from being edited.
  • Added support for deleting identifiers, while preventing required identifiers from being deleted.
  • Added permission and project access checks so users only see identifiers they are authorized to access.
Candidate Identifiers module

Testing Instructions

  1. Open the Candidate Identifiers module and verify that identifiers are displayed correctly.
  2. Filter the table using the different columns and verify that the results are correct.
  3. Add an identifier with a manually entered value and verify that it appears in the table.
  4. Add an identifier with an automatically generated value and verify that it is generated correctly.
  5. Edit an existing identifier and verify that the updated value is saved.
  6. Verify that PSCIDs cannot be edited.
  7. Delete an identifier and verify that it is removed from the table.
  8. Verify that required identifiers cannot be deleted.
  9. Log in with a user who has restricted identifier permissions or project access and verify that only authorized identifiers are displayed.

@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 labels Nov 2, 2026
@HachemJ HachemJ added the State: Blocked PR or issue awaiting an external event such as the merge or another PR to proceed label Nov 2, 2026
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersModule branch from 821cdf9 to 12f7c0b Compare November 2, 2026 21:45
@HachemJ HachemJ changed the title [Candidate Identifier (Rework)] Add Candidate Identifiers Module [Candidate Identifier (Rework Part 5)] Add Candidate Identifiers Module Nov 3, 2026
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersModule branch 2 times, most recently from 131762f to 6dca45d Compare November 4, 2026 16:52
@HachemJ HachemJ added the State: Blocking PR should be prioritized because it is blocking the progress of another task label Nov 4, 2026
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersModule branch from 6dca45d to e02eb2d Compare November 4, 2026 19:14
@HachemJ
HachemJ marked this pull request as ready for review November 10, 2026 16:19
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersModule branch 5 times, most recently from 9c4c4b6 to 603f892 Compare November 19, 2026 19:51

@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 building this on FilterableDataTable and the shared form elements! Mostly small things inline, the two bigger ones are the plain fetch calls and a few strings that aren't translated yet.

Two broader things: could the new files be .tsx function components, like the configuration page in Part 4? And the module doesn't have a README.md, help/ or test/TestPlan.md yet, which the other modules carry.

return;
}

fetch(

@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.

could the requests here go through the shared client in jslib/http? There are four plain fetch calls in the module, this one, the one on line 52 and one in each form

const {t} = this.props;
swal.fire({
title: t('Are you sure?', {ns: 'loris'}),
text: `Delete identifier "${row.IdentifierValue}"?`,

@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.

a few strings here aren't going through t() yet, this one and the success and error popups below, and the same goes for the error messages in both forms. The edit form's button can use t('Save', {ns: 'loris'}) like the add form does

*/
$database = $loris->getDatabaseConnection();

$permissions = $database->pselect(

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.

I think $user->getPermissionIDs() gives you this list directly, so the query over every permission and the hasPermission loop can go

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.

correction on this one, sorry! getPermissionIDs() only reads the user's own permission rows, while hasPermission() also lets superusers through, so swapping it in would hide restricted types from superusers. Feel free to keep the loop as it is

const [saving, setSaving] = useState(false);
const [error, setError] = useState(null);

const editingDisabled = props.identifier.IdentifierType === 'PSCID';

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.

same thing as the PSCID rename on Part 4, this finds PSCID by its name, so whatever we land on there should apply here too

@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersModule branch from 603f892 to cf00d6b Compare November 23, 2026 20:26
@HachemJ

HachemJ commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Hi @HenriRabalais, thanks for the review again

I have just pushed the following updates:

  • Replaced four plain fetch() calls with the shared client in jslib/http.
  • Converted the three JavaScript React class components to TypeScript functional components .tsx.
  • Added missings translations in French for user facing strings and updated the translation files.
  • Added module documentation (README.md), a help page, and a test plan.
  • Ensured PSCID identifiers cannot be edited, with protection in both the UI and API.
  • Fixed the Edit and Delete actions to correctly handle identifier values from the DataTable.

It's ready to be reviewed for a second time.

Thanks again.

@HenriRabalais
HenriRabalais self-requested a review November 23, 2026 22:04

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