Feature/changes user role user groups tabs#343
Merged
adrianq merged 6 commits intodevelopmentfrom Apr 27, 2026
Merged
Conversation
To support hiding roles with empty users after excluding users outside org units, load all roles once (like user groups) and apply filtering/sorting/pagination in-memory. Add UI permission for the new filter and repository support to fetch all roles.
- Extract duplicate functions - Refactor to use generic parameter
…tings Admins can now set the initial state of boolean filters (org unit scope, hide not applicable) for User Groups, User Roles and Dashboards tabs. The "Show/Hide Filters" section is renamed to "Filters" and uses a Visible/Default two-column layout. Visible and Default are independent, so the admin can pre-set the default even when the filter is hidden. Unifies the settings migration helpers into a single generic migrateRecord used both for actionsAccess and the three uiXxxActionsAccess records, preserving stored values while back-filling new fields/keys from defaults. Adds tests for mergeAndAddRuntimeProps covering legacy storage, full records and missing-key migration.
BundleMonNo change in files bundle size Groups updated (1)
Final result: ✅ View report in BundleMon website ➡️ |
Member
Contributor
Author
|
@adrianq Nice catch, I missed this one. The fix looks good to me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 References
📝 Implementation
This branch consolidates several changes to the User Groups, User Roles and Dashboards tabs, both in behaviour and in App Settings.
1. Hide "Filter by Users" column in DHIS2 2.42 (
3ba477e)DHIS2 2.42 moved several user properties out of
userCredentials. The "Filter by Users" column and related filter is now hidden on 2.42 instances where the filtering contract is incompatible,avoiding broken queries.
2. Add Hide not applicable user roles filter (
d57f97b)User Roles tab now mirrors User Groups behaviour: after filtering users by the current org unit scope, roles with no remaining users are hidden in memory when "Hide not applicable user roles" is
enabled. Previously this only worked via API for User Groups.
3. Shared implementation between User Roles and User Groups (
c2890be)Refactor to remove duplicated filtering / org-unit scoping logic between the two tabs, so they now share the same code paths.
4. Load all users when org-unit scope is disabled in users filter (
cb4c056)When the "Show only users assigned to my organization unit and below" toggle is off, the "Filter by Users" dropdown now fetches all users via a new
GetAllUsersSimpleUseCase, so the admincan filter by users outside the current scope.
5. Configurable default value for boolean filters in App Settings (
fef5a3d)App Settings → Filter Permissions can now configure, per tab (User Groups / User Roles / Dashboards), not only Visible but also Default for the boolean filters:
filterUsersInOrgUnit(all three tabs)filterHideNotApplicableUserGroups/filterHideNotApplicableUserRolesThe
Show/Hide Filterssection is renamed toFiltersand uses a two-columnVisible | Defaultlayout.VisibleandDefaultare independent — the admin can pre-configure the default stateeven when the filter is hidden from non-admin users. Defaults apply to admin and non-admin alike.
On the data layer,
appSettingsHelpers.mergeAndAddRuntimePropswas refactored into a single genericmigrateRecordhelper that back-fills missing keys and missing fields from defaults. Thisreplaces the previous
migrateNewerActionsand merge logic, and covers forward-compatible migration for both class-based (actionsAccess) and plain-object records (uiXxxActionsAccess). Unittests added in
src/data/repositories/common/__tests__/appSettingsHelpers.spec.ts.📹 Screenshots/Screen capture
App settings Before

App settings After

🔥 Testing
Show only users assigned...,Hide not applicable...) have both switches.Filter by Users,Filter by Owners, exports) show only Visible, with—under Default.Show only users assigned to my org unit and belowDefault = OFF in User Groups and save.filterUsersInOrgUnit.visible = falsebutdefaultValue = falseand save. Log in as a non-admin user and verify:Default = ON, open the User Roles tab on a DHIS2 2.42 instance and verify:yarn test— the newappSettingsHelpers.spec.tssuite (6 cases) must pass.defaultValue, reload the app and confirm nothing breaks (missingdefaultValueis back-filled totruebymigrateRecord).