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

Restrict Access to Asset Configurations for Specific Admin Roles #6309

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented Sep 20, 2023

WHAT

🤖 Generated by Copilot at 0078dca

This pull request improves the authorization logic for managing different asset types in the AssetManage component. It uses the useAuthUser hook to check the user roles and restrict the access to the configuration forms for HL7Monitor and ONVIFCamera components to admin users only.

Proposed Changes

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

HOW

🤖 Generated by Copilot at 0078dca

  • Restrict access to asset configuration forms based on user role (link, link, link, link, link, link, link, link)
  • Import useAuthUser hook in HL7Monitor.tsx and ONVIFCamera.tsx to get the current user's type and role (link, link)
  • Declare authUser variable using the hook in both components (link, link)
  • Wrap the components with a conditional rendering based on authUser, to only show the forms to users with DistrictAdmin or StateAdmin roles (link, link)
  • Remove the authorizeFor prop from the AssetManage component in AssetManage.tsx, since the authorization logic is handled by the child components (link, link)

@Ashesh3 Ashesh3 requested a review from a team September 20, 2023 08:11
@Ashesh3 Ashesh3 requested a review from a team as a code owner September 20, 2023 08:11
@vercel
Copy link

vercel bot commented Sep 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
care-storybook ✅ Ready (Inspect) Visit Preview Sep 20, 2023 8:11am

@netlify
Copy link

netlify bot commented Sep 20, 2023

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit 0078dca
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/650aa934d562e9000824b403
😎 Deploy Preview https://deploy-preview-6309--care-egov-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@cypress
Copy link

cypress bot commented Sep 20, 2023

Passing run #1284 ↗︎

0 75 0 0 Flakiness 0

Details:

Restrict Access to Asset Configurations for Specific Admin Roles
Project: CARE Commit: 0078dcafa0
Status: Passed Duration: 03:25 💡
Started: Sep 20, 2023 8:15 AM Ended: Sep 20, 2023 8:19 AM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@nihal467
Copy link
Member

LGTM

@khavinshankar khavinshankar merged commit eb09ecd into develop Sep 20, 2023
40 checks passed
@khavinshankar khavinshankar deleted the issue-6297 branch September 20, 2023 13:19
@github-actions
Copy link

@Ashesh3 We truly appreciate your efforts. Thank you for taking the time to contribute; this is a very valuable contribution to us 🥇. We always welcome your contribution 🙂, so feel free to contribute to anything anytime, and never lose that spirit of innovation 🙌.

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

Successfully merging this pull request may close these issues.

Expose Camera Present configuration to nurses and doctors
3 participants