Skip to content
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: [DHIS2-17084] Filter Relationship Types for write access #3580

Conversation

eirikhaugstulen
Copy link
Contributor

Tech-summary:

  • Filter out any relationship types the user does not have data write access to
  • Do this for both cached indexed db, but also when in self-contained mode

@eirikhaugstulen eirikhaugstulen requested a review from a team as a code owner March 19, 2024 10:30
Copy link
Member

@JoakimSM JoakimSM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this affect both viewing and adding? If I'm not mistaken, we will have to keep the readonly ones for viewing (so part 1 is to do what you basically did in this PR, but check for read access instead). When using the relationship types in the add part, we will have to filter for write access only.

Comment on lines 26 to 27
select: ({ relationshipTypes }: any) => relationshipTypes
.filter(({ access }) => access.data.write),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See general comment first.

A better way to do this is to add filter to the api request, like so: http://localhost:9090/api/relationshipTypes?filter=access.data.read:eq:true

@eirikhaugstulen
Copy link
Contributor Author

Good catch, Joakim! Updated 😊

Copy link

github-actions bot commented Mar 21, 2024

Copy link

@geethaalwan geethaalwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully on 2.41,2.40.4,2.39.6,2.38.7 versions

@eirikhaugstulen eirikhaugstulen merged commit 439c7eb into master Mar 21, 2024
42 checks passed
@eirikhaugstulen eirikhaugstulen deleted the eh/fix/DHIS2-17084-filter-relationships-type-without-write-access branch March 21, 2024 16:13
dhis2-bot added a commit that referenced this pull request Mar 21, 2024
## [100.67.8](v100.67.7...v100.67.8) (2024-03-21)

### Bug Fixes

* [DHIS2-17084] Filter Relationship Types for write access ([#3580](#3580)) ([439c7eb](439c7eb))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.67.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants