Skip to content

feat(registry): consolidate registry configuration into a Registry Settings section - #440

Draft
emjay0921 wants to merge 3 commits into
19.0from
feat/1009-registry-settings
Draft

feat(registry): consolidate registry configuration into a Registry Settings section#440
emjay0921 wants to merge 3 commits into
19.0from
feat/1009-registry-settings

Conversation

@emjay0921

Copy link
Copy Markdown
Contributor

Draft: QA is re-testing the branch now (OP#1009 moved back to In testing). It passed on 12 August against an 8 June 19.0; 19.0 has since moved 438 commits and has been merged in, so the earlier pass no longer certifies what is here. Marking ready once QA confirms.

Why is this change needed?

Registry configuration lived in two places (OP#1009):

  • the Configuration menu inside the Registry app
  • Farmer Registry Settings / SP-MIS Settings in the Settings app, each carrying its own copy of the same toggle

The ticket asks for one Registry Settings section in Settings, equivalent to Programs Settings, with the registry configuration moved there — including superuser configuration such as API V2, which sat under Registry → Configuration.

How was the change implemented?

  • New Registry Settings section in spp_registry, mirroring Programs Settings, carrying Restrict Registry Edits to Admin Only.
  • One toggle, both legacy keys. get_values/set_values keep spp_farmer_registry.registry_admin_only_crud and spp_starter.registry_admin_only_crud in sync, so the Farmer Registry and SP-MIS controllers keep reading their own parameter unchanged — no migration and no change to how the restriction is enforced. The now-duplicate Farmer Registry Settings and SP-MIS Settings sections and their field definitions are removed.
  • Superuser configuration relocated. Registry → Configuration, and the API V2 and Import Match menus hanging off it, move under a new Registry group in the Settings app (base.menu_administration). The API V2 security compliance manifest is updated to match.
  • Two personas granted the Settings app so they can reach the new location: spp_security.group_spp_admin and spp_registry.group_registry_config_admin. Additive via Command.link, so stock system / access-rights visibility is preserved and every section under Settings still enforces its own group gate.
  • The parent menu is declared in res_config_settings_views.xml, which the manifest loads before main_view.xml so the reference resolves.

New unit tests

spp_registry/tests/test_res_config_settings.py — the Registry Settings section reads and writes the toggle, and both legacy parameter keys stay in sync in each direction, which is the property that replaces a data migration.

Unit tests executed by the author

After merging 19.0 in, all five affected modules installed together against current 19.0spp_registry, spp_starter_sp_mis, spp_farmer_registry, spp_api_v2, spp_import_match: 1069 tests, 0 failed, 1 error.

That one error is pre-existing on 19.0 and unrelated to this branch: spp_registry/tests/test_phone_number.py::test_unparseable_phone_falls_back_to_original expects "abcxyz" to fall through to phone_sanitized, while spp_base_common/models/phone_number.py:41 raises Phone number must not contain letters. from its create() override. Both files are unchanged here and untouched by this branch. It stays hidden in CI because spp_registry does not depend on spp_base_common, so the per-module matrix never installs them together; it surfaces only in a combined install like the one above. Raising it separately.

How to test manually

  1. Settings → a Registry Settings section appears, in the same style as Programs Settings, containing Restrict Registry Edits to Admin Only.
  2. The old Farmer Registry Settings / SP-MIS Settings sections are gone.
  3. Turn the toggle on: a non-admin registry user can still read registrants but cannot create, edit or delete. Turn it off: they can edit again.
  4. Settings → Technical → System Parameters, search registry_admin_only_crud — both keys follow the toggle in both directions.
  5. Registry → Configuration no longer holds API V2 or Import Match; both are under Settings → Registry and work as before.
  6. As OpenSPP Administrator and as Registry Configuration Admin: the Settings app is visible and Settings → Registry is reachable, with everything else under Settings still gated.

Related links

emjay0921 added 3 commits June 9, 2026 11:19
…y config (#1009)

- New 'Registry Settings' section in the Settings app (spp_registry),
  mirroring 'Programs Settings', carrying the 'Restrict Registry Edits to
  Admin Only' toggle.
- The toggle keeps both legacy config-parameter keys
  (spp_farmer_registry.registry_admin_only_crud and
  spp_starter.registry_admin_only_crud) in sync via get_values/set_values,
  so the spp_farmer_registry and spp_starter_sp_mis controllers keep
  reading their own key — no migration, no enforcement change. Removed the
  now-duplicate 'Farmer Registry Settings' and 'SP-MIS Settings' sections
  and their field definitions.
- Relocated the API V2 and Import Match menus out of Registry > Configuration
  into a new 'Registry' group under the Settings app (Settings > Registry),
  and updated the API V2 security compliance manifest to match.
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.71%. Comparing base (0820667) to head (76a05e7).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #440      +/-   ##
==========================================
+ Coverage   72.24%   72.71%   +0.46%     
==========================================
  Files         419      555     +136     
  Lines       29813    37892    +8079     
==========================================
+ Hits        21539    27553    +6014     
- Misses       8274    10339    +2065     
Flag Coverage Δ
spp_analytics 93.25% <ø> (ø)
spp_api_v2 79.99% <ø> (?)
spp_api_v2_change_request 66.53% <ø> (ø)
spp_api_v2_cycles 71.03% <ø> (ø)
spp_api_v2_data 77.77% <ø> (ø)
spp_api_v2_entitlements 70.23% <ø> (ø)
spp_api_v2_gis 71.57% <ø> (ø)
spp_api_v2_products 65.86% <ø> (?)
spp_api_v2_programs 92.22% <ø> (ø)
spp_api_v2_service_points 71.03% <ø> (ø)
spp_api_v2_simulation 71.19% <ø> (?)
spp_api_v2_vocabulary 57.75% <ø> (?)
spp_approval 50.34% <ø> (?)
spp_base_common 91.07% <ø> (ø)
spp_farmer_registry 88.46% <ø> (?)
spp_import_match 84.16% <ø> (?)
spp_programs 65.27% <ø> (ø)
spp_registry 87.51% <100.00%> (+0.36%) ⬆️
spp_security 69.56% <ø> (ø)
spp_starter_sp_mis 80.00% <ø> (-6.67%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
spp_farmer_registry/models/__init__.py 100.00% <ø> (ø)
spp_registry/models/__init__.py 100.00% <100.00%> (ø)
spp_registry/models/res_config_settings.py 100.00% <100.00%> (ø)

... and 137 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant