Repository navigation
Architecture
The ESN Membership Manager (esn_membership_manager) is a modular Drupal 10/11 module built on top of the Omnia
(esn-cy/omnia) foundation. This page documents its core entities, database schema, services, stream wrapper, action
plugins, and background jobs.
Both primary domain objects are fieldable Drupal Content Entities extending Omnia's EnumBackedEntityBase:
| Entity ID | Class | Base Table | Storage / Access Handlers |
|---|---|---|---|
membership_application |
Drupal\esn_membership_manager\Entity\Application\Application |
membership_application |
ApplicationStorage, ApplicationAccess
|
membership_guest |
Drupal\esn_membership_manager\Entity\GuestPass\GuestPass |
membership_guest |
GuestPassStorage, GuestPassAccess
|
-
Field Enums:
ApplicationFieldandGuestPassFielddefine typed field metadata, read-only rules (based on email/ID/status verification), and ESNcard-exclusive flags. -
Cascade Clean-up (
postDelete):Deleting an
Applicationautomatically deletes its private files, associatedGuestPassentities, Stripe Payment Link, Google Wallet passes, Apple Wallet device registrations, and authentication tokens.
Defined in esn_membership_manager.install:
| Table | Purpose |
|---|---|
esn_membership_manager_cards |
Inventory pool of physical ESNcard numbers (id, number, assigned). |
esn_membership_manager_in_progress_applications |
Temporary state for in-progress registrations (email, Didit session/results, ESN Accounts CAS results). |
esn_membership_manager_authentication |
8-digit one-time email verification codes with expiration timestamps (register/login). |
esn_membership_manager_apple_wallet_registrations |
iOS device registrations (device_library_identifier, serial_number, push_token) for Apple Wallet APNs push updates. |
Registered in esn_membership_manager.services.yml:
-
esn_membership_manager.esncard_service(ESNcardService):Validates and inserts ESNcard inventory, assigns cards transactionally (
SELECT ... FOR UPDATE), managesBACKLOGGED/BACKLOGGED-MANUALqueues, and executes post-assignment hooks (Weeztix, Google Sheets, Wallet links, email). -
esn_membership_manager.guest_pass_service(GuestPassService):Evaluates Instant Limit and Special Mobility rules, creates Guest Pass entities, and triggers auto-approval when eligible.
-
esn_membership_manager.file_service(FileService):Manages private application files stored under the
membership://stream wrapper. -
esn_membership_manager.cron_service(CronService):Delegates
hook_cron()toGDPRCron. -
esn_membership_manager.stripe_service(StripeService):Extends
StripeServiceBase(Omnia) to create standard/ESNer payment links, verify webhook signatures, and fetch prices. -
esn_membership_manager.didit_service(DiditService):Interfaces with Didit Verification API v3 (
session,decision,delete,generate-pdf). -
esn_membership_manager.weeztix_service(WeeztixService):Handles Weeztix OAuth2 token lifecycle and
PUT /coupon/{listID}/codessyncing. -
esn_membership_manager.google_service(GoogleService):Extends
GoogleServiceBase(Omnia) for Google Auth, Google Sheets row appending, and Google Wallet Generic Classes/Objects (card,pass,guest). -
esn_membership_manager.apple_wallet_service(AppleService):Extends
AppleServiceBase(Omnia) for Sign in with Apple,.pkpasssigning (ESNcard,FreePass,GuestPass), and APNs push notifications. -
plugin.manager.membership_dashboard_section(DashboardSectionManager):Drupal
DefaultPluginManagerdiscovering#[DashboardSection]plugins underPlugin\DashboardSectionfor the Member Self-Service Dashboard.
- Implemented by
MembershipStreamWrapper(stream_wrapper.membership), storing files outside the web root in../../private/esn_membership_manager_storagewith aDeny from all.htaccess. - Protected by
hook_file_download()andFileAccessController(/memberships/files/{applicationID}/{filename}), ensuring only authorised users (e.g., officers withview applications) can access uploaded IDs, proofs of status, and photos.
Bulk and single-item status transitions are implemented as Drupal @Action plugins under src/Plugin/Action/:
-
esn_membership_manager_approve(ApproveApplication) -
esn_membership_manager_reject(RejectApplication) -
esn_membership_manager_delete(DeleteApplication) -
esn_membership_manager_mark_paid(MarkApplicationAsPaid) -
esn_membership_manager_issue(IssueCard) -
esn_membership_manager_deliver(DeliverCard) -
esn_membership_manager_blacklist(BlacklistApplication) -
esn_membership_manager_approve_guest(ApproveGuestPass)
The Member Self-Service Dashboard (/memberships/dashboard) is assembled dynamically from PHP #[DashboardSection]
attribute plugins under src/Plugin/DashboardSection/, managed by DashboardSectionManager:
-
application(ApplicationSection, weight10) — Personal/mobility details, inline editing, and document re-uploads. -
wallet(WalletSection, weight20) — Google Wallet and Apple Wallet pass links. -
guest(GuestPassSection, weight30) — Active Guest Passes table and request form.
Companion modules can contribute additional sections, sidebar navigation entries, overview Quick Actions, and interactive form actions using the built-in UI builders. See Dashboard Extensions for the full developer guide.
Outgoing emails extend MembershipEmailBase and use Omnia's EmailService with Twig templates in templates/:
PassConfirmationEmail, BothConfirmationEmail, PassApprovalEmail, BothApprovalEmail, RejectionEmail,
CardAssignmentEmail, CardIssuanceEmail, BlacklistEmail, GuestPassApprovalEmail, BacklogEmail, and
AuthenticationEmail.
Executed via esn_membership_manager_cron():
-
14-day retention: Deletes
StatusProofFileIDandIdentityDocumentFileIDfiles and nullifies their fields. -
1-year retention: Runs
Application::postDelete()cleanup and anonymizes PII (Name,Surname,Email,DateOfBirth,FacePhotoFileID, payment links).