Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

fix(sidebar): sidebar should only show links user has access to see #2112

Merged
merged 14 commits into from
Jun 7, 2020
Merged

Conversation

blestab
Copy link
Contributor

@blestab blestab commented Jun 2, 2020

Fixes #2110.

Changes proposed in this pull request:

  • Only add patients/new link if user has Permissions.WritePatients
  • Only add patients list link if user has Permissions.ReadPatients
  • Only add appointments/new link if user has Permissions.WriteAppointments
  • Only add appointments list link if user has Permissions.ReadAppointments
  • Only add labs/new link if user has Permissions.RequestLab
  • Only add labs list link if user has Permissions.ViewLabs
  • Only add incidents/new link if user has Permissions.ReportIncident
  • Only add incidents list link if user has Permissions.ViewIncidents
  • Unit Tests (do not show link if user does not have the appropriate privileges to access the link)

@jsf-clabot
Copy link

jsf-clabot commented Jun 2, 2020

CLA assistant check
All committers have signed the CLA.

@gitpod-io
Copy link

gitpod-io bot commented Jun 2, 2020

@vercel
Copy link

vercel bot commented Jun 2, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hospitalrun/hospitalrun-frontend/bpgd4g7zt
✅ Preview: https://hospitalrun-frontend-git-fork-blestab-master.hospitalrun.now.sh

@matteovivona matteovivona requested review from jackcmeyer, irvelervel and a user June 2, 2020 08:39
ghost
ghost previously approved these changes Jun 3, 2020
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

It looks fabulous! Thank you 🙏

@matteovivona matteovivona requested review from fox1t and removed request for irvelervel June 3, 2020 15:10
@matteovivona matteovivona added the in progress indicates that issue/pull request is currently being worked on label Jun 3, 2020
@matteovivona matteovivona added this to the v2.0 milestone Jun 3, 2020
@matteovivona
Copy link
Contributor

Let's have @fox1t check it too, since it's something related to ACL server side feature

Copy link
Member

@jackcmeyer jackcmeyer left a comment

Choose a reason for hiding this comment

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

we should have tests to prove when certain permissions are not on the user, then the links do not render.

@blestab
Copy link
Contributor Author

blestab commented Jun 4, 2020

we should have tests to prove when certain permissions are not on the user, then the links do not render.

Thanks @jackcmeyer, I will attempt to add those in.

@blestab
Copy link
Contributor Author

blestab commented Jun 5, 2020

we should have tests to prove when certain permissions are not on the user, then the links do not render.

Thanks @jackcmeyer, I will attempt to add those in.

I have pushed some unit tests code.

Note though, I thought I only needed to test those scenarios where we do not want to show links since the existing tests, by virtue of them having all privileges setup, are also therefore testing cases where we do want the links to show, i.e. when the user has the correct privileges to access the link(s) in question; I hope that was an okay assumption to make.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

👊 🙂

@matteovivona matteovivona merged commit f3b3c7f into HospitalRun:master Jun 7, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
in progress indicates that issue/pull request is currently being worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sidebar should only show links which user has access to see
4 participants