-
Notifications
You must be signed in to change notification settings - Fork 57
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
chore(j-s): Access for prisons to appeal rulings #16138
Conversation
WalkthroughThe changes introduce a new user type check for prison staff in the case file access logic, specifically allowing access to certain case file categories for users identified as prison staff. A new constant is defined for prison staff case file categories, and the access logic is adjusted to accommodate this new user type. Additionally, the test cases have been reorganized to reflect the distinction between prison admin users and prison users, ensuring clarity in permissions related to case file access. Changes
Possibly related PRs
Suggested labels
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Outside diff range and nitpick comments (1)
apps/judicial-system/backend/src/app/modules/file/guards/test/limitedAccessViewCaseFileGuard.spec.ts (1)
Line range hint
216-307
: LGTM! Well-structured tests for prison admin users.The tests for prison admin users are comprehensive and well-organized. They cover various scenarios across different case types, states, and file categories, aligning with the PR objectives.
A minor suggestion for improvement:
Consider extracting the
allowedCaseFileCategories
array to a constant at the top of the file or in a separate constants file. This would make it easier to maintain and reuse across different test cases if needed.const PRISON_ADMIN_ALLOWED_CATEGORIES = [ CaseFileCategory.APPEAL_RULING, CaseFileCategory.RULING, ];Then use this constant in your tests:
describe.each(PRISON_ADMIN_ALLOWED_CATEGORIES)( 'prison admin users can view %s', (category) => { // ... rest of the test }Tools
Biome
[error] 287-295: Disallow duplicate setup and teardown hooks.
Disallow beforeEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
[error] 348-356: Disallow duplicate setup and teardown hooks.
Disallow beforeEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
[error] 377-385: Disallow duplicate setup and teardown hooks.
Disallow beforeEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- apps/judicial-system/backend/src/app/modules/file/guards/caseFileCategory.ts (3 hunks)
- apps/judicial-system/backend/src/app/modules/file/guards/test/limitedAccessViewCaseFileGuard.spec.ts (4 hunks)
Additional context used
Path-based instructions (2)
apps/judicial-system/backend/src/app/modules/file/guards/caseFileCategory.ts (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/judicial-system/backend/src/app/modules/file/guards/test/limitedAccessViewCaseFileGuard.spec.ts (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
Biome
apps/judicial-system/backend/src/app/modules/file/guards/test/limitedAccessViewCaseFileGuard.spec.ts
[error] 287-295: Disallow duplicate setup and teardown hooks.
Disallow beforeEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
[error] 348-356: Disallow duplicate setup and teardown hooks.
Disallow beforeEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
Additional comments not posted (3)
apps/judicial-system/backend/src/app/modules/file/guards/test/limitedAccessViewCaseFileGuard.spec.ts (1)
Line range hint
216-307
: LGTM! Comprehensive and well-structured tests.The overall structure and completeness of the tests are excellent. They cover various scenarios for different user roles, case types, states, and file categories. The additions for prison admin users and prison users are consistent with existing test patterns and thoroughly test the access rights.
The changes successfully meet the PR objectives by:
- Restoring the ability for prison users to view appeal rulings.
- Differentiating between prison admin users and regular prison users.
- Ensuring that access is properly restricted based on user roles and case states.
These tests provide good coverage and should help prevent future regressions in access control for different user roles.
Tools
Biome
[error] 287-295: Disallow duplicate setup and teardown hooks.
Disallow beforeEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
[error] 348-356: Disallow duplicate setup and teardown hooks.
Disallow beforeEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
[error] 377-385: Disallow duplicate setup and teardown hooks.
Disallow beforeEach duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
apps/judicial-system/backend/src/app/modules/file/guards/caseFileCategory.ts (2)
43-43
: Verify intentional overlap of 'APPEAL_RULING' in case file categories
CaseFileCategory.APPEAL_RULING
appears in bothprisonStaffCaseFileCategories
andprisonAdminCaseFileCategories
. Please confirm that this overlap is intentional and aligns with the required access permissions.
46-46
:⚠️ Potential issueFix typo in function name 'canLimitedAcccessUserViewCaseFile'
The function name
canLimitedAcccessUserViewCaseFile
has an extra 'c' in "Access". Please correct the spelling tocanLimitedAccessUserViewCaseFile
.Apply this diff to fix the typo:
-export const canLimitedAcccessUserViewCaseFile = ( +export const canLimitedAccessUserViewCaseFile = (Likely invalid or redundant comment.
...icial-system/backend/src/app/modules/file/guards/test/limitedAccessViewCaseFileGuard.spec.ts
Show resolved
Hide resolved
apps/judicial-system/backend/src/app/modules/file/guards/caseFileCategory.ts
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16138 +/- ##
=======================================
Coverage 36.70% 36.71%
=======================================
Files 6761 6761
Lines 139077 139076 -1
Branches 39501 39500 -1
=======================================
+ Hits 51054 51060 +6
+ Misses 88023 88016 -7
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 2 Total Test Services: 0 Failed, 2 Passed Test Services
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Access for prisons to appeal rulings
Asana
What
Enable prison users to see appeal rulings
Why
This was recently removed and turns out, prisons actually need to be able to see appeal rulings.
Screenshots / Gifs
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
Tests