-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add permissions to JWT #1119
Add permissions to JWT #1119
Conversation
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.
lgtm with a suggestion on removing magic strings.
For certain method calls, we need to add additional permissions to the JWT: e.g. when adding a model, we need to add cloud permission stating that the user has permission to add-model on that cloud.
3b636f1
to
13f545c
Compare
permissionMap = make(map[string]string, len(permissons)) | ||
for _, p := range permissons { | ||
permissionMap[p.resource] = p.relation | ||
} | ||
} | ||
|
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.
This is smart. I would have sent the map instead of the variadic args and would have ended up constructing the map everywhere and duplicating code. Your way is much smarter. I learned something new today
Description
For certain method calls, we need to add additional permissions to the JWT: e.g. when adding a model, we need to add cloud permission stating that the user has permission to add-model on that cloud.
Engineering checklist
Check only items that apply
Test instructions
Notes for code reviewers