mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-07 16:42:23 +00:00
get oidc user info from projections and add actions
This commit is contained in:
@@ -34,6 +34,27 @@ func UserMetadataListFromQuery(c *actions.FieldConfig, metadata *query.UserMetad
|
||||
return c.Runtime.ToValue(result)
|
||||
}
|
||||
|
||||
func UserMetadataListFromSlice(c *actions.FieldConfig, metadata []query.UserMetadata) goja.Value {
|
||||
result := &userMetadataList{
|
||||
// Count was the only field ever queries from the DB in the old implementation,
|
||||
// so Sequence and LastRun are omitted.
|
||||
Count: uint64(len(metadata)),
|
||||
Metadata: make([]*userMetadata, len(metadata)),
|
||||
}
|
||||
for i, md := range metadata {
|
||||
result.Metadata[i] = &userMetadata{
|
||||
CreationDate: md.CreationDate,
|
||||
ChangeDate: md.ChangeDate,
|
||||
ResourceOwner: md.ResourceOwner,
|
||||
Sequence: md.Sequence,
|
||||
Key: md.Key,
|
||||
Value: metadataByteArrayToValue(md.Value, c.Runtime),
|
||||
}
|
||||
}
|
||||
|
||||
return c.Runtime.ToValue(result)
|
||||
}
|
||||
|
||||
func metadataByteArrayToValue(val []byte, runtime *goja.Runtime) goja.Value {
|
||||
var value interface{}
|
||||
if !json.Valid(val) {
|
||||
|
||||
Reference in New Issue
Block a user