mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-03 22:22:14 +00:00
fix(listUsers): Add Search User By Phone to User Service V2 (#9052)
# Which Problems Are Solved
Added search by phone to user Service V2.
```
curl --request POST \
--url https://<zitadel_domain>/v2/users \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <Token>' \
--header 'Content-Type: application/json' \
--header 'content-type: application/json' \
--data '{
"query": {
"offset": "0",
"limit": 100,
"asc": true
},
"sortingColumn": "USER_FIELD_NAME_UNSPECIFIED",
"queries": [
{
"phoneQuery": {
"number": "+12011223313",
"method": "TEXT_QUERY_METHOD_EQUALS"
}
}
]
}'
```
Why?
Searching for a user by phone was missing from User Service V2 and V2
beta.
# How the Problems Are Solved
* Added to the SearchQuery proto
* Added code to filter users by phone
# Additional Changes
N/A
# Additional Context
Search by phone is present in V3 User Service
---------
Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
This commit is contained in:
@@ -30,6 +30,7 @@ message SearchQuery {
|
||||
NotQuery not_query = 13;
|
||||
InUserEmailsQuery in_user_emails_query = 14;
|
||||
OrganizationIdQuery organization_id_query = 15;
|
||||
PhoneQuery phone_query = 16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +185,26 @@ message EmailQuery {
|
||||
];
|
||||
}
|
||||
|
||||
// Query for users with a specific phone.
|
||||
message PhoneQuery {
|
||||
string number = 1 [
|
||||
(validate.rules).string = {max_len: 20},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
description: "Phone number of the user"
|
||||
min_length: 1;
|
||||
max_length: 20;
|
||||
example: "\"+41791234567\"";
|
||||
}
|
||||
];
|
||||
zitadel.object.v2.TextQueryMethod method = 2 [
|
||||
(validate.rules).enum.defined_only = true,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
description: "defines which text equality method is used";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
// Query for users with a specific state.
|
||||
message LoginNameQuery {
|
||||
string login_name = 1 [
|
||||
|
||||
@@ -30,6 +30,7 @@ message SearchQuery {
|
||||
NotQuery not_query = 13;
|
||||
InUserEmailsQuery in_user_emails_query = 14;
|
||||
OrganizationIdQuery organization_id_query = 15;
|
||||
PhoneQuery phone_query = 16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +185,26 @@ message EmailQuery {
|
||||
];
|
||||
}
|
||||
|
||||
// Query for users with a specific phone.
|
||||
message PhoneQuery {
|
||||
string number = 1 [
|
||||
(validate.rules).string = {max_len: 20},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
description: "Phone number of the user"
|
||||
min_length: 1;
|
||||
max_length: 20;
|
||||
example: "\"+41791234567\"";
|
||||
}
|
||||
];
|
||||
zitadel.object.v2beta.TextQueryMethod method = 2 [
|
||||
(validate.rules).enum.defined_only = true,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
description: "defines which text equality method is used";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
// Query for users with a specific state.
|
||||
message LoginNameQuery {
|
||||
string login_name = 1 [
|
||||
|
||||
Reference in New Issue
Block a user