-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix: handle both Set and array for currentUser.authorities when checking interpretations access [DHIS2-15964] #1586
Conversation
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.
LGTM 👍
src/components/Interpretations/common/getInterpretationAccess.js
Outdated
Show resolved
Hide resolved
src/components/Interpretations/common/getInterpretationAccess.js
Outdated
Show resolved
Hide resolved
src/components/Interpretations/common/getInterpretationAccess.js
Outdated
Show resolved
Hide resolved
src/components/Interpretations/common/getInterpretationAccess.js
Outdated
Show resolved
Hide resolved
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 approve now after pushing some changes. But I guess another team member should also approve (and merge).
Changes by @HendrikThePendric LGTM. The function should throw an error if the needed arguments are not provided by the app. |
Superseded by the combo PR #1588 |
Fixes https://dhis2.atlassian.net/browse/DHIS2-15964
In the olden days when we used d2.currentUser,
authorities
was a Set.With the migration to the app-runtime, requesting currentUser or /me with the dataEngine, the
authorities
will be an array.Choosing here to handle both instead of requiring array (and thus a major upgrade) since we have no documentation or strict types on our functions/components.
So apps that get the currentUser from d2 (like DV) and apps that get currentUser from dataEngine(like LL) will both work.
Maybe support for Set can be removed in a future major release.