fix querying claim data on the dashboard (#1560)

This commit is contained in:
Caleb Doxsey 2020-10-29 10:49:02 -06:00 committed by GitHub
parent 93c257259e
commit 10b5c5ca0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 56 additions and 39 deletions

View file

@ -69,3 +69,14 @@ func (x *User) AddClaims(claims identity.FlattenedClaims) {
x.Claims[k] = svs
}
}
// GetClaim returns a claim.
//
// This method is used by the dashboard template HTML to display claim data.
func (x *User) GetClaim(claim string) []interface{} {
var vs []interface{}
for _, sv := range x.GetClaims()[claim].GetValues() {
vs = append(vs, sv.AsInterface())
}
return vs
}