mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-01 07:57:24 +00:00

# Which Problems Are Solved - Adds support for the list users SCIM v2 endpoint # How the Problems Are Solved - Adds support for the list users SCIM v2 endpoints under `GET /scim/v2/{orgID}/Users` and `POST /scim/v2/{orgID}/Users/.search` # Additional Changes - adds a new function `SearchUserMetadataForUsers` to the query layer to query a metadata keyset for given user ids - adds a new function `NewUserMetadataExistsQuery` to the query layer to query a given metadata key value pair exists - adds a new function `CountUsers` to the query layer to count users without reading any rows - handle `ErrorAlreadyExists` as scim errors `uniqueness` - adds `NumberLessOrEqual` and `NumberGreaterOrEqual` query comparison methods - adds `BytesQuery` with `BytesEquals` and `BytesNotEquals` query comparison methods # Additional Context Part of #8140 Supported fields for scim filters: * `meta.created` * `meta.lastModified` * `id` * `username` * `name.familyName` * `name.givenName` * `emails` and `emails.value` * `active` only eq and ne * `externalId` only eq and ne
51 lines
877 B
Go
51 lines
877 B
Go
package http
|
|
|
|
import (
|
|
"errors"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/schema"
|
|
|
|
"github.com/zitadel/zitadel/internal/zerrors"
|
|
)
|
|
|
|
type Parser struct {
|
|
decoder *schema.Decoder
|
|
}
|
|
|
|
func NewParser() *Parser {
|
|
d := schema.NewDecoder()
|
|
d.IgnoreUnknownKeys(true)
|
|
return &Parser{d}
|
|
}
|
|
|
|
func (p *Parser) Parse(r *http.Request, data interface{}) error {
|
|
err := r.ParseForm()
|
|
if err != nil {
|
|
return zerrors.ThrowInternal(err, "FORM-lCC9zI", "error parsing http form")
|
|
}
|
|
|
|
return p.decoder.Decode(data, r.Form)
|
|
}
|
|
|
|
func (p *Parser) UnwrapParserError(err error) error {
|
|
if err == nil {
|
|
return nil
|
|
}
|
|
|
|
// try to unwrap the error
|
|
var multiErr schema.MultiError
|
|
if errors.As(err, &multiErr) && len(multiErr) == 1 {
|
|
for _, v := range multiErr {
|
|
var schemaErr schema.ConversionError
|
|
if errors.As(v, &schemaErr) {
|
|
return schemaErr.Err
|
|
}
|
|
|
|
return v
|
|
}
|
|
}
|
|
|
|
return err
|
|
}
|