-
Notifications
You must be signed in to change notification settings - Fork 5
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
List user roles #875
List user roles #875
Conversation
Codecov ReportBase: 44.01% // Head: 44.03% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #875 +/- ##
==========================================
+ Coverage 44.01% 44.03% +0.01%
==========================================
Files 635 635
Lines 23176 23192 +16
Branches 1416 1416
==========================================
+ Hits 10202 10213 +11
- Misses 11639 11642 +3
- Partials 1335 1337 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
Thanks for adding this in so quickly!
pkg/bff/api/v1/api.go
Outdated
@@ -19,6 +19,7 @@ type BFFClient interface { | |||
|
|||
// User Management Endpoints | |||
Login(context.Context) error | |||
ListUserRoles(context.Context) (map[string]struct{}, error) |
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.
Why a map[string]struct{}
instead of []string
? How does this render in JSON - something like below?
{
"Organization Leader": {},
"Organization Contributor": {}
}
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.
I didn't want to impose ordering on it but I can make it a []string
if that's easier.
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.
I think []string
is probably simpler.
func (s *APIv1) ListUserRoles(ctx context.Context) (out map[string]struct{}, err error) { | ||
// Make the HTTP request | ||
var req *http.Request | ||
if req, err = s.NewRequest(ctx, http.MethodGet, "/v1/users/roles", nil, nil); err != nil { |
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.
good endpoint
Scope of changes
This adds a simple endpoint to list the available user roles, which is currently hard coded in the BFF, in order to unblock frontend development of the collaborators feature.
Type of change
Acceptance criteria
Describe how reviewers can test this change to be sure that it works correctly. Add a checklist if possible
Author checklist
Reviewer(s) checklist