Skip to content

WEB-1242: Add the tenant management administration UI - #4035

Merged
IOhacker merged 1 commit into
openMF:devfrom
YousufFFFF:WEB-1242-tenant-management-session-and-list
Sep 22, 2026
Merged

IOhacker merged 1 commit into
openMF:devfrom
YousufFFFF:WEB-1242-tenant-management-session-and-list

Conversation

@YousufFFFF

@YousufFFFF YousufFFFF commented Sep 22, 2026

Copy link
Copy Markdown
Member

Description

Adds a Tenant Management section under Administration → System that lists the tenants of a Fineract installation, backed by the tenant management plugin's /v1/admin/tenants API (MX-406).

The web app has never had a tenants API binding: the login tenant selector renders a static list read from the FINERACT_PLATFORM_TENANTS_IDENTIFIER environment variable. This is the first half of that work — master sign-in, the API binding, the list with search, status filter and server-side paging, and a read-only tenant detail page. Creating, editing, the lifecycle commands and the connection test follow in a second PR.

Two things about the delivered backend shape the design and are worth calling out for review.

Tenant administration has its own credential. The plugin runs in a master context above every tenant: it authenticates HTTP Basic against master users in the tenant store and requires the SUPER_MASTER role. A tenant's own user is refused with 401 however privileged it is in that tenant — ALL_FUNCTIONS included. The web app session therefore cannot be reused here, and
per-user permission gating is not available, so the section opens on its own sign-in card. The credential it obtains lives in sessionStorage for that tab only, with no "remember me", and AuthenticationService clears it on logout so signing out of the web app cannot leave a higher-privilege session behind.

The API is called on a client with no interceptors. AuthenticationInterceptor ends with request.clone({ setHeaders }), which would overwrite the master Authorization header with the tenant session's and attach a tenant header this API is not addressed by. It sits on the DI interceptor chain, so HttpService's existing opt-outs do not reach it. The service builds its client from HttpBackend, as RemittancesService and the ngx-translate loader already do for differently authenticated endpoints, and parses Fineract error bodies itself. That last part is deliberate rather than a gap: a 401 on the master credential is not the web app session expiring and must not raise the global alert that says it is. A 401 also ends the master session, so the section
falls back to its sign-in card instead of failing every later request the same way.

The section is behind MIFOS_ENABLE_TENANT_MANAGEMENT, off by default: a server running stock Fineract has no tenant administration API at all, so the tile stays hidden rather than offering a feature that cannot work. The flag follows the existing MIFOS_ENABLE_COPILOT shape across environment.ts, environment.prod.ts, env.template.js and env.sample.

Login tenant selector. Where the list is known to be complete and unfiltered, the identifiers it saw are remembered, so a deployment that registers tenants through the API does not have to list them in the environment as well. A filtered result or one page of a longer list is not the set of tenants on the installation and is not cached. They are kept under their own storage key, because the configured list is re-seeded from the environment on every bootstrap and on every visit to the login page, which would erase anything written into it. calculateTenantSelectorVisibility() previously read the environment variable directly, so it now considers the union — otherwise a deployment configured with only default would keep the selector hidden no matter what the API reported. With the feature flag off, both the getter and the visibility check return the configured list unchanged and nothing about the selector changes.

No route resolvers are used anywhere in this feature, unlike the rest of System. The master credential may not exist when a route activates, and a resolver would fire an unauthenticated request before the sign-in card could render, so each page fetches its own data once the credential is in place. There is a comment in the routing module saying so.

All new copy is added to every one of the 13 locale files (31 keys each). Tenant statuses go through labels.catalogs, so a status value the backend names falls back to itself.

Covered by 11 new Jest tests: the master session keeps a credential only once the server has accepted it, encodes it as UTF-8 so a non-Latin-1 password does not throw, sends no tenant header, and drops everything on sign-out; the list renders the API's rows, offers the statuses the backend reported rather than a hardcoded list, and remembers identifiers only from a complete, unfiltered result.

Related issues and discussion

WEB-1242. Depends on the tenant management plugin from MX-406

(https://github.com/openMF/mifos-x-tenantmanagement-plugin), which is merged.

Screenshots, if any

Screen.Recording.2026-09-23.015538.mp4

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • If you have multiple commits please combine them into one commit by squashing them.

  • Read and understood the contribution guidelines at web-app/.github/CONTRIBUTING.md.

Summary by CodeRabbit

  • New Features
    • Added an optional Tenant Management area for viewing, searching, filtering, and inspecting tenant details.
    • Added master-user sign-in and sign-out for tenant administration.
    • Tenant identifiers discovered through management are now available during tenant selection.
    • Added deployment configuration to show or hide Tenant Management, disabled by default.
  • Bug Fixes
    • Signing out now clears stored tenant master credentials.
    • Improved handling of tenant-management authentication and unavailable-plugin errors.
  • Documentation
    • Added translated labels and messages across supported locales.

@YousufFFFF
YousufFFFF requested a review from a team September 22, 2026 20:43
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: openMF/web-app/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 1bc43679-955d-4466-94e4-15c5e9b2fb85

📥 Commits

Reviewing files that changed from the base of the PR and between 6e9d897 and b67e159.

📒 Files selected for processing (44)
  • env.sample
  • src/app/core/authentication/authentication.service.ts
  • src/app/home/activities.ts
  • src/app/login/login.component.ts
  • src/app/settings/settings.service.ts
  • src/app/system/system-routing.module.ts
  • src/app/system/system.component.html
  • src/app/system/system.component.ts
  • src/app/system/system.module.ts
  • src/app/system/tenant-management/master-login/master-login.component.html
  • src/app/system/tenant-management/master-login/master-login.component.scss
  • src/app/system/tenant-management/master-login/master-login.component.ts
  • src/app/system/tenant-management/models/tenant.model.ts
  • src/app/system/tenant-management/tenant-management-error.ts
  • src/app/system/tenant-management/tenant-management.component.html
  • src/app/system/tenant-management/tenant-management.component.scss
  • src/app/system/tenant-management/tenant-management.component.ts
  • src/app/system/tenant-management/tenant-management.service.ts
  • src/app/system/tenant-management/tenant-master-session.service.spec.ts
  • src/app/system/tenant-management/tenant-master-session.service.ts
  • src/app/system/tenant-management/tenants.component.html
  • src/app/system/tenant-management/tenants.component.scss
  • src/app/system/tenant-management/tenants.component.spec.ts
  • src/app/system/tenant-management/tenants.component.ts
  • src/app/system/tenant-management/tenants.datasource.ts
  • src/app/system/tenant-management/view-tenant/view-tenant.component.html
  • src/app/system/tenant-management/view-tenant/view-tenant.component.scss
  • src/app/system/tenant-management/view-tenant/view-tenant.component.ts
  • src/assets/env.template.js
  • src/assets/translations/cs-CS.json
  • src/assets/translations/de-DE.json
  • src/assets/translations/en-US.json
  • src/assets/translations/es-CL.json
  • src/assets/translations/es-MX.json
  • src/assets/translations/fr-FR.json
  • src/assets/translations/it-IT.json
  • src/assets/translations/ko-KO.json
  • src/assets/translations/lt-LT.json
  • src/assets/translations/lv-LV.json
  • src/assets/translations/ne-NE.json
  • src/assets/translations/pt-PT.json
  • src/assets/translations/sw-SW.json
  • src/environments/environment.prod.ts
  • src/environments/environment.ts
 __________________________________________________________
< This regex looks like you sneezed on the keyboard-twice. >
 ----------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "pre_merge_checks"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@YousufFFFF
YousufFFFF force-pushed the WEB-1242-tenant-management-session-and-list branch from 19fb2fc to b67e159 Compare September 22, 2026 20:45
@IOhacker
IOhacker merged commit cfbca3f into openMF:dev Sep 22, 2026
6 of 7 checks passed
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.

2 participants