Data dictionary for the identity layer. Source constants: IdentityModel.cs, AuthenticationModels.cs, permissions.ts.
Core entities
| Term |
Definition |
Lives in |
| ApplicationUser |
The login/identity record. One per user, keyed to one OrganisationId. |
MembershipDb |
| Person |
The rich HR record (department, paygrade, bank, history). Scoped by CompanyId. |
TenantDb |
| Organisation |
The top-level tenant — what an account owns. Contains one or more Companies. |
MembershipDb |
| Company |
A business unit under an Organisation; the scope of most operational data. |
MembershipDb (defn) / TenantDb (data) |
| MembershipDb |
Platform-wide master store: identity, orgs, companies, reference data, permission catalog. |
— |
| TenantDb |
Per-tenant store: HR/operational data, resolved by TenantDbFactory. |
— |
| WarehouseDb |
Analytics/reporting store. |
— |
Authentication
| Term |
Definition |
| JWT |
The access token. HmacSha256-signed; carries 14 claims. |
| Access token / refresh token |
Short-lived JWT + longer-lived refresh credential (RefreshAccessToken). |
| encryptionKey |
Per-environment symmetric key — both signs the JWT and encrypts sensitive claim values. |
| 2FA (TOTP) |
Authenticator-app second factor. Seed from GetTwoFactorAuthenticationKey. |
| SSO / OAuth |
Google/Microsoft login (SsoAuthenticate / OAuthAuthenticate). |
| Control login |
Separate door for internal PaidHR staff (ControlAuthenticate). |
JWT claims (ClaimParams)
| Claim |
Meaning |
Encrypted? |
username, displayname, userid |
Identity |
no |
organisationid, companyid |
Tenant scope |
yes |
organisationname |
Tenant name |
no |
ewaid, companyewaid |
EWA linkage |
no |
secretkey |
Per-token secret |
— |
domain |
Tenant domain |
no |
isadmin |
Fast admin flag |
no |
context |
Sign-in context (below) |
no |
roles |
Admin tier(s) |
no |
permissions |
Per-permission grants |
no |
Sign-in status (SignInStatusParams)
Success · Failed · TwoFactorRequired · TwoFactorSetupRequired · PasswordResetRequired · LockedOut · NotAllowed
Sign-in context (SignInContextParams)
| Value |
Meaning |
Owned |
Acting in an org the user owns — tenant claims trusted. |
Acquired |
Acting in a granted org (consultant/sub-company) — tenant claims trusted. |
ReadOnly |
View-only session. |
TwoFactor / TwoFactorSetup / TwoFactorSetupRequired |
Mid-2FA gate. |
PasswordResetRequired |
Mid-reset gate. |
Authorization
| Term |
Definition |
| Admin tier |
One of ~26 named functional bundles (AdminRole constants). The coarse layer. |
| Permission |
A single grant, e.g. can cancel payrolls. The fine layer. ~199 backend / ~230 frontend. |
| alias |
The snake_case key (can_*) that joins a frontend permission to its backend Permission. |
| Custom role |
Org-defined bundle of permissions (AdminRolesService). |
| Primary Admin |
Account owner. All-access. One per org. Transferable (ChangePrimaryAdmin). |
| Secondary Admin |
All-access except owner-only actions. |
| Bypass |
Primary/Secondary Admins skip per-permission checks (usePermissions). |
| RequireRoutePermit |
Frontend route guard; renders Unauthorized if no matching permission. |
The ~26 admin tiers (AdminRole → int ID)
| Tier |
ID |
Tier |
ID |
| Primary Admin |
1 |
KYC Admin |
31 |
| Secondary Admin |
2 |
EWA Admin |
157 |
| Limited Access |
3 |
Wallet Admin |
164 |
| Payroll Admin |
4 |
Tax Admin |
165 |
| Payroll Reports & Tax Filings Admin |
5 |
Pension Admin |
166 |
| HR Admin |
6 |
Vendors Admin |
167 |
| Time Tracking & Leave Admin |
7 |
Control Admin |
168 |
| Benefits Admin |
8 |
Statutory Admin |
169 |
| Loans, Salary Advance & Tax Relief Admin |
9 |
Accounts Admin |
26 |
| IT Admin |
22 |
Invoices Admin |
27 |
| Assets Admin |
23 |
Transactions Admin |
28 |
| Performance Admin |
24 |
Support Admin |
29 |
| Auditor |
25 |
Communications Admin |
30 |
IDs are non-contiguous (gaps at 10–21, 32–156, 158–163) — historical, added over time. Do not renumber; external data references these exact ints. (RFD-003)
Permission naming — two catalogs, one alias
| Layer |
Style |
Example |
Count |
Backend Permission |
Title case |
"Can create employees" |
199 |
Frontend Permission enum |
snake_case alias |
can_create_employees |
230 |
Reconcile by alias, not by count — the frontend enum includes finer/UI-only entries.