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

fix(auth-admin): Removed Legal guardian minor delegation type from access control #16676

Merged
merged 3 commits into from
Nov 4, 2024

Conversation

GunnlaugurG
Copy link
Member

@GunnlaugurG GunnlaugurG commented Oct 31, 2024

What

Removed Legal guardian minor delegation type from access control

Why

So it will not be displayed

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Implemented filtering for delegations of type "Legal Guardian Minor" in both incoming and outgoing delegation components, preventing their display in the user interface.
  • Bug Fixes

    • Improved rendering logic to ensure only relevant delegations are shown, enhancing user experience.

@GunnlaugurG GunnlaugurG requested a review from a team as a code owner October 31, 2024 13:32
Copy link
Contributor

coderabbitai bot commented Oct 31, 2024

Walkthrough

The changes in this pull request involve modifications to two components, DelegationsIncoming.tsx and DelegationsOutgoing.tsx. Both components now include conditional checks to exclude delegations of type AuthDelegationType.LegalGuardianMinor from rendering. This adjustment alters the control flow by preventing the display of AccessCard components for these specific delegations, while the overall structure and other functionalities of the components remain unchanged.

Changes

File Change Summary
libs/portals/shared-modules/delegations/src/components/delegations/incoming/DelegationsIncoming.tsx Added conditional check to filter out AuthDelegationType.LegalGuardianMinor from rendering.
libs/portals/shared-modules/delegations/src/components/delegations/outgoing/DelegationsOutgoing.tsx Added conditional check to filter out AuthDelegationType.LegalGuardianMinor from rendering.

Possibly related PRs

Suggested labels

automerge


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (3)
libs/portals/shared-modules/delegations/src/components/delegations/incoming/DelegationsIncoming.tsx (2)

61-63: LGTM! Consider adding a comment explaining the business context.

The implementation correctly filters out LegalGuardianMinor delegations. Consider adding a comment explaining why this delegation type is excluded for better maintainability.

+// Legal guardian minor delegations are handled separately and should not be displayed
 if (delegation.type === AuthDelegationType.LegalGuardianMinor)
   return null

Line range hint 1-140: Component structure follows best practices for shared modules.

The component demonstrates good practices for shared library code:

  • Proper TypeScript usage with well-defined types
  • Modular imports supporting tree-shaking
  • Reusable component structure suitable for different NextJS apps
libs/portals/shared-modules/delegations/src/components/delegations/outgoing/DelegationsOutgoing.tsx (1)

Line range hint 1-190: Consider enhancing component reusability.

To improve reusability across different NextJS apps, consider making the filtered delegation types configurable through props. This would allow the component to be more flexible and reusable in different contexts.

Here's a suggestion for making the component more configurable:

interface DelegationsOutgoingProps {
  excludedDelegationTypes?: AuthDelegationType[];
  // ... other props
}

export const DelegationsOutgoing = ({
  excludedDelegationTypes = [AuthDelegationType.LegalGuardianMinor],
  // ... other props
}: DelegationsOutgoingProps) => {
  // ... existing code
}

This way, the component can be reused with different filtering requirements while maintaining the current default behavior.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5d1f145 and cdd7f8b.

📒 Files selected for processing (2)
  • libs/portals/shared-modules/delegations/src/components/delegations/incoming/DelegationsIncoming.tsx (1 hunks)
  • libs/portals/shared-modules/delegations/src/components/delegations/outgoing/DelegationsOutgoing.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
libs/portals/shared-modules/delegations/src/components/delegations/incoming/DelegationsIncoming.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/portals/shared-modules/delegations/src/components/delegations/outgoing/DelegationsOutgoing.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (1)
libs/portals/shared-modules/delegations/src/components/delegations/incoming/DelegationsIncoming.tsx (1)

61-63: Verify the impact on existing delegations.

The removal of LegalGuardianMinor delegations might affect users with existing delegations of this type.

Let's verify the usage and potential impact:

@GunnlaugurG GunnlaugurG added the automerge Merge this PR as soon as all checks pass label Nov 4, 2024
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.55%. Comparing base (37504e0) to head (43f3f81).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16676      +/-   ##
==========================================
- Coverage   36.55%   36.55%   -0.01%     
==========================================
  Files        6882     6882              
  Lines      143417   143417              
  Branches    40877    40877              
==========================================
- Hits        52430    52429       -1     
- Misses      90987    90988       +1     
Flag Coverage Δ
air-discount-scheme-backend 54.03% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-domains-air-discount-scheme 36.96% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.48% <ø> (ø)
api-domains-communications 39.82% <ø> (ø)
api-domains-criminal-record 47.40% <ø> (ø)
api-domains-driving-license 44.44% <ø> (ø)
api-domains-education 31.20% <ø> (ø)
api-domains-health-insurance 34.23% <ø> (ø)
api-domains-mortgage-certificate 34.63% <ø> (ø)
api-domains-payment-schedule 41.19% <ø> (ø)
application-api-files 56.49% <ø> (ø)
application-core 71.61% <ø> (-0.25%) ⬇️
application-system-api 41.29% <ø> (+<0.01%) ⬆️
application-template-api-modules 27.79% <ø> (+0.02%) ⬆️
application-templates-accident-notification 29.21% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.26% <ø> (ø)
application-templates-driving-license 18.40% <ø> (ø)
application-templates-estate 12.18% <ø> (ø)
application-templates-example-payment 25.17% <ø> (ø)
application-templates-financial-aid 15.56% <ø> (ø)
application-templates-general-petition 23.40% <ø> (ø)
application-templates-inheritance-report 6.52% <ø> (ø)
application-templates-marriage-conditions 15.20% <ø> (ø)
application-templates-mortgage-certificate 43.52% <ø> (ø)
application-templates-parental-leave 29.93% <ø> (ø)
application-types 6.62% <ø> (ø)
application-ui-components 1.27% <ø> (ø)
application-ui-shell 20.86% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.12% <ø> (ø)
clients-driving-license-book 43.38% <ø> (ø)
clients-financial-statements-inao 48.91% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
clients-regulations 42.18% <ø> (ø)
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.15% <ø> (ø)
cms 0.42% <ø> (ø)
cms-translations 38.95% <ø> (ø)
contentful-apps 4.69% <ø> (ø)
dokobit-signing 62.40% <ø> (ø)
download-service 44.23% <ø> (ø)
email-service 60.24% <ø> (ø)
feature-flags 90.32% <ø> (ø)
file-storage 52.41% <ø> (ø)
financial-aid-backend 51.24% <ø> (ø)
judicial-system-api 19.57% <ø> (ø)
judicial-system-audit-trail 68.53% <ø> (ø)
judicial-system-backend 55.24% <ø> (ø)
judicial-system-message 66.66% <ø> (ø)
judicial-system-message-handler 47.53% <ø> (ø)
judicial-system-scheduler 70.35% <ø> (ø)
license-api 42.54% <ø> (+0.07%) ⬆️
nest-config 77.74% <ø> (ø)
nest-feature-flags 50.83% <ø> (ø)
nova-sms 61.71% <ø> (ø)
portals-admin-regulations-admin 1.85% <ø> (ø)
portals-core 15.96% <ø> (ø)
services-auth-admin-api 51.87% <ø> (ø)
services-auth-delegation-api 57.52% <ø> (+0.06%) ⬆️
services-auth-ids-api 51.46% <ø> (ø)
services-auth-personal-representative 45.08% <ø> (+0.03%) ⬆️
services-auth-personal-representative-public 41.27% <ø> (+<0.01%) ⬆️
services-auth-public-api 48.95% <ø> (-0.01%) ⬇️
services-endorsements-api 53.58% <ø> (ø)
services-sessions 65.32% <ø> (ø)
services-university-gateway 49.19% <ø> (-0.06%) ⬇️
services-user-notification 46.89% <ø> (-0.02%) ⬇️
services-user-profile 61.82% <ø> (+0.16%) ⬆️
web 1.80% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37504e0...43f3f81. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 4, 2024

Datadog Report

All test runs 911e488 🔗

70 Total Test Services: 0 Failed, 67 Passed
🔻 Test Sessions change in coverage: 2 decreased, 4 increased, 194 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 82 0 32.72s N/A Link
air-discount-scheme-web 0 0 0 2 0 8.51s N/A Link
api 0 0 0 4 0 2.72s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 18.06s N/A Link
api-domains-assets 0 0 0 3 0 11.46s N/A Link
api-domains-auth-admin 0 0 0 18 0 10.37s 1 no change Link
api-domains-communications 0 0 0 5 0 26.91s 1 no change Link
api-domains-criminal-record 0 0 0 5 0 8.17s 1 no change Link
api-domains-driving-license 0 0 0 23 0 29.96s N/A Link
api-domains-education 0 0 0 8 0 20.09s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • application-core - jest 79.62% (-0.1%) - Details
  • services-university-gateway - jest 45.06% (-0.02%) - Details

@svanaeinars svanaeinars added automerge Merge this PR as soon as all checks pass and removed automerge Merge this PR as soon as all checks pass labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants