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

Allow deferred types and silent authMode per Authorized decorator #1452

Open
angelhodar opened this issue May 4, 2023 · 1 comment
Open
Labels
Question ❔ Not future request, proposal or bug issue

Comments

@angelhodar
Copy link

angelhodar commented May 4, 2023

Is your feature request related to a problem? Please describe.
I am having problems with circular dependency when using a user role enum on Authorized in props (no problem in resolvers). Also I dont want to throw errors when access is denied to a single prop, just return null. But if the decorator is used in a resolver, it is fine to return the errors. The current solution is global by defining the authMode: "null" in the buildSchema.

Describe the solution you'd like
I would like something like this:

@Authorized(() => [UserType.STAFF, UserType.MANAGER], { silent: true })
@Field({ nullable: true })
someProp: boolean;
@MichalLytek
Copy link
Owner

Declare the enum type in separate file, aside from other object types.

@MichalLytek MichalLytek added the Question ❔ Not future request, proposal or bug issue label May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question ❔ Not future request, proposal or bug issue
Projects
None yet
Development

No branches or pull requests

3 participants
@MichalLytek @angelhodar and others