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

Issue 163 implement basic backend endpoint permissions #221

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tommyjqliu
Copy link
Collaborator

@tommyjqliu tommyjqliu commented Feb 15, 2024

Change Summary

  • Permission: add permission matrix and implement permission check in api handler
  • Permission: add test case to see if permission check working
  • User: refactor code, inject user object into request so following handler can get user from context directly
  • User: inject mock user in testApiHandler for test convenient, also add relative documentation
  • Other: Optimize file path in test folder.

By the way, not all the endpoint is listed in the Repair Lab Permissions Matrix, may need to update the matrix.
https://docs.google.com/spreadsheets/d/18AxrBPgUUgtK0lcNLxSUmxFfxQERglB_L3c7OL6s9DE/edit#gid=1755505050

Change Form

Fill this up (NA if not available). If a certain criteria is not met, can you please give a reason.

  • The pull request title has an issue number
  • The change works by "Smoke testing" or quick testing
  • The change has tests
  • The change has documentation

Other Information

Future improvement

  • merge page permission and api permission and automatically add permission check to endpoint with regexp.

@tommyjqliu tommyjqliu requested a review from dct0 February 15, 2024 13:55
@tommyjqliu tommyjqliu self-assigned this Feb 15, 2024
@tommyjqliu tommyjqliu linked an issue Feb 15, 2024 that may be closed by this pull request
@dct0 dct0 requested a review from justinliangg February 17, 2024 03:22
Copy link
Collaborator

Choose a reason for hiding this comment

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

This middleware will be removed from https://github.com/codersforcauses/repair-labs/tree/issue-165-Refactor_users_page and replaced with a higher-order component to check auth status.

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

Successfully merging this pull request may close these issues.

Implement basic backend endpoint permissions
2 participants