Problem/Motivation

Sites using Amilia (Smart Rec) for membership management need a way to validate whether a given email address belongs to an active member. One application would be so that Virtual Y (yusaopeny_gated_content) can gate content to members only.

The Amilia API provides a "Persons in a network by email" endpoint that can perform this lookup in real time using the existing JWT Bearer token authentication already present in YmcaSmartRecAmiliaApiClient.

Steps to reproduce

N/A — this is a feature addition, not a bug fix.

Proposed resolution

  1. New constant in YmcaSmartRecAmiliaApiClient:

    SMART_REC_API_NETWORK_PERSONS_PATH = 'network/%s/persons'
  2. New config setting smart_rec_network_id added to the module
    settings form and config schema.
  3. New method getPersonsByEmail(string $email): array|false
    • Builds the endpoint URL: GET /api/v3/{language}/network/{networkId}/persons?email={email}
    • Authenticates with the existing smartRecAmiliaAuthorizeRequest() mechanism
    • Returns the decoded Items array on success, or FALSE if no
      record is found or an error occurs
    • Logs a watchdog warning and returns FALSE if smart_rec_network_id
      is not configured

Remaining tasks

  • Implement and review the changes above
  • Add smart_rec_network_id to the settings form and config schema
  • Manual testing against a real Amilia network
  • Create companion issue in yusaopeny_gated_content for the openy_gc_auth_smart_rec auth provider that consumes this new method

User interface changes

New Network ID field on the Smart Rec settings form (/admin/config/ymca-settings/smart-rec).

API changes

New public method on YmcaSmartRecAmiliaApiClient (service openy_smart_rec.smart_rec_api_client):

public function getPersonsByEmail(string $email): array|false

Data model changes

New config key smart_rec_network_id added to
openy_smart_rec.settings.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

froboy created an issue. See original summary.

froboy’s picture

Issue summary: View changes

froboy’s picture

Status: Active » Needs review
podarok’s picture

Version: 1.0.x-dev » 1.1.0
Status: Needs review » Fixed

tnx

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.