-
Notifications
You must be signed in to change notification settings - Fork 316
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(rbac): reduce requests to credentials API #2955
base: main
Are you sure you want to change the base?
fix(rbac): reduce requests to credentials API #2955
Conversation
Signed-off-by: Oleksandr Andriienko <[email protected]>
Missing ChangesetsThe following package(s) are changed by this PR but do not have a changeset:
See CONTRIBUTING.md for more information about how to add changesets. Changed Packages
|
Signed-off-by: Oleksandr Andriienko <[email protected]>
|
||
if (decision.result === AuthorizeResult.DENY) { | ||
throw new NotAllowedError(); // 403 | ||
if (credentials.principal.type !== 'user') { |
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.
Will the code get here (this)?
Maybe we can update the message there Only creadential principal with type 'user' permitted to modify permissions
to:
Only credential principal of type 'user' is permitted to create or modify permissions
|
||
if (decision.result === AuthorizeResult.DENY) { | ||
throw new NotAllowedError(); // 403 | ||
if (credentials.principal.type !== 'user') { |
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.
Same as above.
|
||
if (decision.result === AuthorizeResult.DENY) { | ||
throw new NotAllowedError(); // 403 | ||
if (credentials.principal.type !== 'user') { |
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.
Same as above
Tested and works fine. Only had some small comments. Thank you @AndrienkoAleksandr, this greatly cleans up the code! |
Hey, I just made a Pull Request!
Reduce requests to credentials API, simplify code a bit.
✔️ Checklist
Signed-off-by
line in the message. (more info)