Backend: User entity has isHidden field and corresponding checks&api added
Backend: Tests adapted and added
Backend: New exception type UserHiddenException
Backend: Helper function to return a customized User in test (by getUser)
Frontend: Storybook page for UsersTables
Frontend: Add hide/unhide in UsersTables w/ tests
Screenshots (Optional)
Hide/Unhide user page
Admin can hide/unhide users
A hidden user cannot do any operation (see backend checks). All endpoints with "ROLE_USER" are disabled.
Feedback Request (Optional)
Future Possibilities (Optional)
Right now, all permission (hidden or not) checks are done at the endpoints. That means whenever a new api is added, the user.isHidden() needs to be checked. I wonder if there's a more elegant way (on top of everything, just like the ROLE_*) to do the checks.
Validation (Optional)
Tests
[x] Backend Unit tests (mvn test) pass
[x] Backend Test coverage (mvn test jacoco:report) 100%
[x] Backend Mutation tests (mvn test pitest:mutationCoverage) 100%
[x] Frontend Unit tests (npm test) pass
[x] Frontend Test coverage (npm run coverage) 100%
Needs #85 to be merged first.
Overview
In this PR, the frontend of the hide/unhide users is implemented. See https://ucsb-cs156-m23.github.io/proj-happycows-m23-10am-4/prs/86/storybook/?path=/story/components-users-userstable--three-users
It also has the changes to backend same as #85.
Here's a list of detailed changes for grading:
isHidden
field and corresponding checks&api addedUserHiddenException
getUser
)Screenshots (Optional)
Hide/Unhide user page
Admin can hide/unhide users
A hidden user cannot do any operation (see backend checks). All endpoints with "ROLE_USER" are disabled.
Feedback Request (Optional)
Future Possibilities (Optional)
Right now, all permission (hidden or not) checks are done at the endpoints. That means whenever a new api is added, the
user.isHidden()
needs to be checked. I wonder if there's a more elegant way (on top of everything, just like theROLE_*
) to do the checks.Validation (Optional)
Tests
mvn test
) passmvn test jacoco:report
) 100%mvn test pitest:mutationCoverage
) 100%npm test
) passnpm run coverage
) 100%npx stryker run
) 100%npx eslint --fix src
)Linked Issues
Closes #84 Closes #48