Skip to content

Make authorizer work for nested relations #355

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

Merged
merged 6 commits into from
Jul 29, 2025

Conversation

jtomaszewski
Copy link
Contributor

@jtomaszewski jtomaszewski commented Jan 31, 2025

Currently authorizer works more-or-less only one level down.

For example, if you have following entities:

  • TaskDTO
    • .subTasks (SubTaskDTO)
      • .subSubTasks (SubSubTaskDTO)

Then if you try to fetch tasks along with their sub-tasks and sub-sub-tasks; the authorizer of SubSubTaskDTO isn't used, nor is the relation.auth used which can be defined at SubTaskDTO level for the subSubTasks relation.

This PR fixes it - so that authorizers defined in nested DTOs are also called, if they exist.

P.S. For now this PR makes the fix only for read relations, but I can easily do it for update/remove relations resolvers too. @TriPSs just let me know if you're okay with the fix and be willing to merge this - then I'll finish the PR so it works for the other resolvers as well.

@jtomaszewski
Copy link
Contributor Author

@TriPSs , do you have any comment on this?

Copy link

nx-cloud bot commented Jul 29, 2025

View your CI Pipeline Execution ↗ for commit 39c1122

Command Status Duration Result
nx run-many --target=e2e --all ✅ Succeeded 2m 38s View ↗
nx run-many --target=test --all ✅ Succeeded 43s View ↗
nx run-many --target=lint --all ✅ Succeeded 31s View ↗
nx run-many --target=build --all ✅ Succeeded 5s View ↗
nx run workspace:version ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-29 14:05:48 UTC

@TriPSs TriPSs merged commit 573a480 into TriPSs:master Jul 29, 2025
13 checks passed
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.

2 participants