mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-24 05:38:46 +00:00
fix: scim 2 filter: the username should be treated case-insensitive (#9257)
# Which Problems Are Solved - when listing users via scim v2.0 filters applied to the username are applied case-sensitive # How the Problems Are Solved - when a query filter is appleid on the username it is applied case-insensitive # Additional Context Part of https://github.com/zitadel/zitadel/issues/8140
This commit is contained in:
@@ -288,6 +288,7 @@ func NewTextQuery(col Column, value string, compare TextComparison) (*textQuery,
|
||||
// handle the comparisons which use (i)like and therefore need to escape potential wildcards in the value
|
||||
switch compare {
|
||||
case TextEqualsIgnoreCase,
|
||||
TextNotEqualsIgnoreCase,
|
||||
TextStartsWith,
|
||||
TextStartsWithIgnoreCase,
|
||||
TextEndsWith,
|
||||
@@ -334,6 +335,8 @@ func (q *textQuery) comp() sq.Sqlizer {
|
||||
return sq.NotEq{q.Column.identifier(): q.Text}
|
||||
case TextEqualsIgnoreCase:
|
||||
return sq.ILike{q.Column.identifier(): q.Text}
|
||||
case TextNotEqualsIgnoreCase:
|
||||
return sq.NotILike{q.Column.identifier(): q.Text}
|
||||
case TextStartsWith:
|
||||
return sq.Like{q.Column.identifier(): q.Text + "%"}
|
||||
case TextStartsWithIgnoreCase:
|
||||
@@ -368,6 +371,7 @@ const (
|
||||
TextContainsIgnoreCase
|
||||
TextListContains
|
||||
TextNotEquals
|
||||
TextNotEqualsIgnoreCase
|
||||
|
||||
textCompareMax
|
||||
)
|
||||
|
||||
@@ -905,6 +905,19 @@ func TestNewTextQuery(t *testing.T) {
|
||||
Compare: TextNotEquals,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "not equal ignore case",
|
||||
args: args{
|
||||
column: testCol,
|
||||
value: "h_urst%",
|
||||
compare: TextNotEqualsIgnoreCase,
|
||||
},
|
||||
want: &textQuery{
|
||||
Column: testCol,
|
||||
Text: "h\\_urst\\%",
|
||||
Compare: TextNotEqualsIgnoreCase,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "starts with",
|
||||
args: args{
|
||||
@@ -1194,6 +1207,28 @@ func TestTextQuery_comp(t *testing.T) {
|
||||
query: sq.ILike{"test_table.test_col": "Hurst"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "not equals",
|
||||
fields: fields{
|
||||
Column: testCol,
|
||||
Text: "Hurst",
|
||||
Compare: TextNotEquals,
|
||||
},
|
||||
want: want{
|
||||
query: sq.NotEq{"test_table.test_col": "Hurst"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "not equals ignore case",
|
||||
fields: fields{
|
||||
Column: testCol,
|
||||
Text: "Hurst",
|
||||
Compare: TextNotEqualsIgnoreCase,
|
||||
},
|
||||
want: want{
|
||||
query: sq.NotILike{"test_table.test_col": "Hurst"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "equals ignore case wildcard",
|
||||
fields: fields{
|
||||
|
||||
Reference in New Issue
Block a user