-
Notifications
You must be signed in to change notification settings - Fork 10
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
Ignore duplicate groups returned by the Microsoft Graph API #387
base: main
Are you sure you want to change the base?
Conversation
AFAICT, we don't have any tests which test the |
@@ -186,35 +186,75 @@ func (p Provider) getGroups(token *oauth2.Token, msgraphHost string) ([]info.Gro | |||
} | |||
|
|||
var groups []info.Group | |||
var msGroupNames []string |
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.
Wouldn't be better to use a set for this e.g. a map[string]struct{}
? And maybe use unicode.SimpleFold
to add both cases there?
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.
To be able to include the unfolded group names in the log message, we need to store it unfolded. We could use a map[string]string
for that, mapping the folded name to the unfolded one, but tbh I'm not sure the performance benefit is worth the effort
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.
Wouldn't be better to use a set for this e.g. a map[string]struct{}?
Or do you want to store the unfolded name in that map? Then we would still need to iterate over it so there is no performance benefit
@3v1n0 ping? |
It's not clear in which case the Graph API returns multiple groups with the same name (or the same group twice), but we've seen it happen in ubuntu/authd#789.
Closes ubuntu/authd#789
UDENG-6030