Skip to content

chore(api): add memberIdOrLfid param support and user validation endpoints #3009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

skwowet
Copy link
Member

@skwowet skwowet commented Apr 24, 2025

Overview

This PR introduces LFID support across member-related endpoints and adds new APIs to support user validation from the Individual Dashboard (ID). It also includes permission refinements and audit logging.

Highlights

  • LFID Support: Middleware resolves :memberIdOrLfid to a canonical memberId (UUID), allowing endpoints to accept either a member UUID or LFID.
  • Granular Permissions: Identity and organization CRUD, as well as validation actions, now use fine-grained permission checks for better security and role separation.
  • Audit Logging: All user validation actions are recorded in a new memberUserValidations table, with audit log hooks for traceability.

🔄 Modified Endpoints

  • The following existing endpoints now support the :memberIdOrLfid (either a member UUID or LFID) param:
    • GET /member/:memberIdOrLfid/organization
  • Internal logic refactored to use req.memberId (set by the new middleware).
  • Permissions for identity and organization endpoints are now more granular (e.g., memberIdentityCreate, memberOrganizationRead, etc.).

🆕 New Endpoints

GET /member/:memberIdOrLfid/detected-identity

Returns detected identities for a member (LFID) that have not yet been validated, including an optional activityCount for username identities.

Permissions: memberIdentityRead

Response Example:

[
  {
    "id": "string",
    "platform": "string",
    "type": "string",
    "value": "string",
    "verified": true,
    "activityCount": number
  }
]

POST /member/:memberIdOrLfid/user-validation

Creates a user validation record for a member identity (accept or reject).

Permissions: memberUserValidationCreate

Request Body Example:

{
  "action": "accept" | "reject",
  "details": { "identityId": "string" }
}

Response: 200 OK

GET /member/:memberIdOrLfid/organization/status

Checks if work history records exist for the member.

Permissions: memberOrganizationRead

Response Example:

{ "status": true }

POST /member/:memberIdOrLfid/organization/user-validation

Creates a user validation record for a member’s organization (create, update, or delete).

Permissions: memberUserValidationCreate

Request Body Example:

{
  "action": "create" | "update" | "delete",
  "details": {
    "organizationId": "string",
    "organizationName": "string",
    "title": "string",
    "dateStart": "string",
    "dateEnd": "string"
  }
}

Response: 200 OK

🗄️ Data Layer & Audit Logging

  • New table: memberUserValidations for storing user validation actions.
  • Data access layer extended with methods for creating and querying validations.
  • Audit logging for all validation actions via new action type.

🔐 Permissions & Roles

  • New externalService role and fine-grained permissions for all new and updated endpoints.
  • User validation endpoints are accessible only to the externalService role.

…ndpoints

- Add endpoints for detected identities, work history status, and user validation (identity/org) supporting both memberId and LFID
- Implement memberIdOrLfid middleware for flexible ID resolution
- Update permissions and roles for new endpoints and external service access
- Add audit logging for user validation actions
- Refactor and extend data-access-layer for new validation and activity count logic
- Add migrations for memberUserValidations table
@skwowet skwowet marked this pull request as ready for review April 25, 2025 10:00
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