paultofunmi opened a new pull request, #124:
URL: https://github.com/apache/fineract-backoffice-ui/pull/124
## What was done
Adds `InstitutionConfigService`, a signal-based Angular service that tracks
the
deployment's institution type and exposes which group-lending features are
enabled for it.
- Persists institution type (`'mfis' | 'cb' | 'cu' | 'universal'`) to
`localStorage` under the key `fineract_institution_type`.
- Exposes a readonly `institutionType` signal and a `setInstitutionType()`
method to update and persist it.
- Exposes `isFeatureEnabled('groups' | 'centers' | 'collection_sheet')`,
resolved against a per-institution-type feature matrix:
| Institution type | groups | centers | collection_sheet |
|------------------|:------:|:-------:|:-----------------:|
| `mfis` | yes | yes | yes |
| `cb` | no | no | no |
| `cu` | yes | no | no |
| `universal` | yes | yes | yes |
- Defaults to `'universal'` (all features enabled) when nothing is persisted,
for backward compatibility with existing deployments.
- Validates the stored value against the known union before trusting it,
falling back to the default if the value is missing, invalid, or tampered.
## Testing
Added `institution-config.service.spec.ts` covering:
- Service creation
- Default institution type when storage is empty
- Reading a valid persisted value on init
- Falling back to default on an invalid/unrecognized stored value
- Persisting + updating the signal via `setInstitutionType()`
- Full matrix coverage of `isFeatureEnabled()` across all 4 institution types
× 3 features
Full suite: `552/552` passing, no regressions.
## Related
Closes #119.
This service is a dependency for #113 (RBAC feature flag), which will use
`isFeatureEnabled()` to filter sidebar navigation items by institution config
alongside permission checks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]