feat: sharing dialog prevent users from removing metadata write access [DHIS2-18430]#1694
feat: sharing dialog prevent users from removing metadata write access [DHIS2-18430]#1694
Conversation
|
🚀 Deployed on https://pr-1694--dhis2-ui.netlify.app |
flaminic
left a comment
There was a problem hiding this comment.
Thanks Tom! looks great
| }) | ||
| }) | ||
|
|
||
| describe.only('isMetadataWriteAccessRemoved', () => { |
| dataTest = 'dhis2-uicore-sharingdialog', | ||
| dataSharing = false, | ||
| cascadeDashboardSharing = true, | ||
| preventUsersFromRemovingMetadataWriteAccess = false, |
There was a problem hiding this comment.
i understand it you default to false to not make this a breaking change, but is there a common scenario - in our apps for example - where we'd want them to be able to remove their metadata write access? If not I'd argue the default should be true, and this was a defect before
There was a problem hiding this comment.
Yes; I defaulted to false, so it wouldn't be a breaking change. When we discussed this internally on platform team we had a bit of a hard time imagining a use case for why you would want to allow users to remove their own access. On the other hand, the backend does allow it, so it's hard to say that the current sharing dialog is defective. I can set this to true by default, but then would want to check beyond the platform team if anyone has a use case for wanting users to be able to remove their own access.
There was a problem hiding this comment.
yeah let's leave it False - better safe...
|
# [10.8.0](v10.7.8...v10.8.0) (2025-07-16) ### Features * sharing dialog prevent users from removing metadata write access [DHIS2-18430] ([#1694](#1694)) ([a267689](a267689))



Implements DHIS2-18430
Description
This PR adds a property
preventUsersFromRemovingMetadataWriteAccessto SharingDialog component that lets you prevent users from removing their metadata write access. By default, this property is set tofalse, so that the sharing dialog component will behave as it has previously.If you pass
preventUsersFromRemovingMetadataWriteAccess=true, the sharing dialog will reject and not carry out any action that would leave you without metadata write access after the action is completed. In order to have metadata write access, one or more of the following must be true:ALLauthorityKnown issues
This is not much of an issue but the checks rely on user information at the point the sharing dialog is opened, so if the user's group membership or authorities are updated while the sharing dialog is open, the front end check would not necessarily be accurate. I think that's fine (and unlikely)
Checklist
(there is no documentation for sharing dialog)
I've added a number of unit tests and have added a few e2e tests
the storybook demos don't allow for you to dynamically change fields, do I don't think there's much we could show here except the error message
Screenshots
alinanauser tries to set the sharing on their user to "View only" and gets an error message: