IAM: Add email, login field validation to User create/update API (#112391)
* wip
* wip
* wip
(cherry picked from commit 8cedf25892)
* Search seems to be working, the validation is still wip
* Use keyword.Name analyzer for Filterable fields
* Only string fields should be indexed with keyword analyzer
* Change search query for email and login fields to use term query
* Remove unnecessary Exact from the resource protobuf definitions
Co-Authored-By: Ryan McKinley <ryantxu@gmail.com>
* Add legacy search support to the API
* Tests for legacy search, validate and integration tests for user
* Lint
* Add snapshot tests to userDocumentBuilder
* Address CodeQL issues
* Improvements, handle Mode2, tests should pass
* Change default limit from 0 to 1 for requests
* Cleanup
* Add fixme
* Update pkg/registry/apis/iam/register.go
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
* Update pkg/registry/apis/iam/user/legacy_search.go
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
---------
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
This commit is contained in:
co-authored by
Ryan McKinley
Stephanie Hingtgen
parent
f191acf811
commit
ad9d8098ef
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"key": {
|
||||
"namespace": "default",
|
||||
"group": "iam.grafana.app",
|
||||
"resource": "users",
|
||||
"name": "example"
|
||||
},
|
||||
"name": "example",
|
||||
"rv": 1234,
|
||||
"title": "example",
|
||||
"title_ngram": "example",
|
||||
"title_phrase": "example",
|
||||
"fields": {
|
||||
"email": "example@example.com",
|
||||
"login": "example"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"apiVersion": "iam.grafana.app/v0alpha1",
|
||||
"kind": "User",
|
||||
"metadata": {
|
||||
"name": "example",
|
||||
"namespace": "default"
|
||||
},
|
||||
"spec": {
|
||||
"login": "example",
|
||||
"email": "example@example.com",
|
||||
"role": "Viewer"
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"key": {
|
||||
"namespace": "default",
|
||||
"group": "iam.grafana.app",
|
||||
"resource": "users",
|
||||
"name": "user-with-login-and-email"
|
||||
},
|
||||
"name": "user-with-login-and-email",
|
||||
"rv": 1234,
|
||||
"fields": {
|
||||
"email": "user.one@test.com",
|
||||
"login": "user.one"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"metadata": {
|
||||
"name": "user-with-login-and-email",
|
||||
"namespace": "default"
|
||||
},
|
||||
"spec": {
|
||||
"login": "user.one",
|
||||
"email": "user.one@test.com",
|
||||
"role": "Viewer"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"key": {
|
||||
"namespace": "default",
|
||||
"group": "iam.grafana.app",
|
||||
"resource": "users",
|
||||
"name": "user-with-login-only"
|
||||
},
|
||||
"name": "user-with-login-only",
|
||||
"rv": 1234,
|
||||
"fields": {
|
||||
"login": "user.two"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"metadata": {
|
||||
"name": "user-with-login-only",
|
||||
"namespace": "default"
|
||||
},
|
||||
"spec": {
|
||||
"login": "user.two",
|
||||
"role": "Viewer"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user