New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(#6543): disable aggregate targets for users with multiple facility_ids #9099
base: 6543-multi-facility
Are you sure you want to change the base?
feat(#6543): disable aggregate targets for users with multiple facility_ids #9099
Conversation
@@ -12,8 +12,7 @@ export class AnalyticsFilterComponent implements AfterContentInit, AfterContentC | |||
subscriptions: Subscription = new Subscription(); | |||
|
|||
constructor( | |||
private router: Router, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused dependency
} | ||
|
||
const facilityIds = await this.getUserFacilityIds(); | ||
return !!facilityIds && facilityIds.length <= 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried facilityIds?.length <= 1
, but the static checks didn't like it.
@Benmuiruri @lorerod please have a look at this small PR. I attached a couple of videos and added coverage with unit tests. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @latin-panda
I expected the user who should have multiplefacility_ids
is the CHA not the CHP. In your video I see you enabling and disabling can_aggregate_targets
for the CHP. I wonder, are the users in your test CHA or a CHP ?
However, in my test I have tested with CHA and it works as expected. The one with 1 facility_id
is the only one who can see targets_aggregate
@Benmuiruri the users in my video are CHP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding an end-to-end test in /tests/e2e/default/targets/target-aggregates.wdio-spec.js
for users with multiple facility IDs?
@lorerod thanks for reviewing! I have added the e2e test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @latin-panda !
… into 6543-multi-facility-disable-aggregate-targets
@Benmuiruri, this has been rebased, and the tests are working. It's ready. Just waiting for 6543-multi-facility. |
Description
Users with many associated facilities cannot see target aggregates
To assign more than one facility to a user:
_users
database, find the offline userorg.couchdb:<username>
facility_id
an array and add the IDs:"facility_id: [ "id-1", "id-2" ]
medic
database, find the offline userorg.couchdb:<username>
facility_id
an array and add the IDs:"facility_id: [ "id-1", "id-2" ]
. It should match with the one in_users
db.Videos:
can_aggregate_targets
is disabled. Users with 1 and with many associated facilities cannot see the aggregate targets page.permission-disabled.mp4
can_aggregate_targets
is enabled. Users with 1 associated facility can see the page, but those with many associated facilities cannot see the aggregate targets page.permission-enabled.mp4
#6543
Code review checklist
Compose URLs
If Build CI hasn't passed, these may 404:
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.