Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions users.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,15 @@ func (client *OIDCClient) GetUserInfo(user *OIDCUser) {
return
}
if len(arg) > 0 {
userData := make([]map[string]interface{}, 0)
userData := make([]map[string]any, 0)
err = json.Unmarshal(b, &userData)
// userdata attributes are a KV pair of string:[]any, this casts attributes, finds the specific attribute, casts it to a list of any, and then pulls the first field since there will only ever be one
user.SlackUID = userData[0]["attributes"].(map[string]interface{})["slackuid"].([]interface{})[0].(string)
userAttributes := userData[0]["attributes"].(map[string]any)
if slackIDRaw, exists := userAttributes["slackuid"]; exists {
user.SlackUID = slackIDRaw.([]any)[0].(string)
} else {
logging.Logger.WithFields(logrus.Fields{"method": "GetUserInfo"}).Error("User " + user.Username + " does not have a SlackUID. Skipping messaging.")
}
} else {
err = json.Unmarshal(b, &user)
}
Expand Down