feat: add schema user create and remove (#8494)

# Which Problems Are Solved

Added functionality that user with a userschema can be created and
removed.

# How the Problems Are Solved

Added logic and moved APIs so that everything is API v3 conform.

# Additional Changes

- move of user and userschema API to resources folder
- changed testing and parameters
- some renaming

# Additional Context

closes #7308

---------

Co-authored-by: Elio Bischof <elio@zitadel.com>
This commit is contained in:
Stefan Benz
2024-08-28 21:46:45 +02:00
committed by GitHub
parent 90b908c361
commit 41ae35f2ef
61 changed files with 5766 additions and 2247 deletions

View File

@@ -27,3 +27,11 @@ message Instance {
string domain = 2;
}
}
message Organization {
oneof property {
option (validate.required) = true;
string org_id = 1;
string org_domain = 2;
}
}

View File

@@ -17,7 +17,6 @@ import "zitadel/resources/action/v3alpha/query.proto";
import "zitadel/resources/object/v3alpha/object.proto";
import "zitadel/object/v3alpha/object.proto";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/resources/action/v3alpha;action";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {

View File

@@ -1,15 +1,15 @@
syntax = "proto3";
package zitadel.user.v3alpha;
package zitadel.resources.user.v3alpha;
import "google/api/field_behavior.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "validate/validate.proto";
import "zitadel/object/v2/object.proto";
import "zitadel/resources/object/v3alpha/object.proto";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/user/v3alpha";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/resources/user/v3alpha;user";
message Authenticators {
// All of the user's usernames, which will be used for identification during authentication.
@@ -109,6 +109,50 @@ message WebAuthN {
bool user_verified = 4;
}
message StartWebAuthNRegistration {
// Domain on which the user currently is or will be authenticated.
string domain = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1,
max_length: 200,
example: "\"my-domain.zitadel.cloud\"";
}
];
// Optionally specify the authenticator type of the passkey device (platform or cross-platform).
// If none is provided, both values are allowed.
WebAuthNAuthenticatorType authenticator_type = 2;
// Optionally provide a one time code generated by ZITADEL.
// This is required to start the passkey registration without user authentication.
optional AuthenticatorRegistrationCode code = 3;
}
message VerifyWebAuthNRegistration {
// PublicKeyCredential Interface.
// Generated helper methods populate the field from JSON created by a WebAuthN client.
// See also: https://www.w3.org/TR/webauthn/#publickeycredential
google.protobuf.Struct public_key_credential = 1 [
(validate.rules).message.required = true,
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"type\":\"public-key\",\"id\":\"pawVarF4xPxLFmfCnRkwXWeTrKGzabcAi92LEI1WC00\",\"rawId\":\"pawVarF4xPxLFmfCnRkwXWeTrKGzabcAi92LEI1WC00\",\"response\":{\"attestationObject\":\"o2NmbXRmcGFja2VkZ2F0dFN0bXSiY2FsZyZjc2lnWEcwRQIgRKS3VpeE9tfExXRzkoUKnG4rQWPvtSSt4YtDGgTx32oCIQDPey-2YJ4uIg-QCM4jj6aE2U3tgMFM_RP7Efx6xRu3JGhhdXRoRGF0YVikSZYN5YgOjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2NFAAAAADju76085Yhmlt1CEOHkwLQAIKWsFWqxeMT8SxZnwp0ZMF1nk6yhs2m3AIvdixCNVgtNpQECAyYgASFYIMGUDSP2FAQn2MIfPMy7cyB_Y30VqixVgGULTBtFjfRiIlggjUGfQo3_-CrMmH3S-ZQkFKWKnNBQEAMkFtG-9A4zqW0\",\"clientDataJSON\":\"eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiQlhXdHh0WGxJeFZZa0pHT1dVaUVmM25zby02aXZKdWw2YmNmWHdMVlFIayIsIm9yaWdpbiI6Imh0dHBzOi8vbG9jYWxob3N0OjgwODAifQ\"}}";
min_length: 55;
max_length: 1048576; //1 MB
}
];
// Provide a name for the WebAuthN device. This will help identify it in the future.
string web_auth_n_name = 2 [
(validate.rules).string = {min_len: 1, max_len: 200},
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1;
max_length: 200;
example: "\"fido key\""
}
];
}
message OTPSMS {
// unique identifier of the one-time-password (OTP) SMS authenticator.
string otp_sms_id = 1 [
@@ -167,7 +211,7 @@ message AuthenticationKey {
example: "\"69629023906488334\"";
}
];
zitadel.object.v2.Details details = 2;
zitadel.resources.object.v3alpha.Details details = 2;
// the file type of the key
AuthNKeyType type = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
@@ -246,6 +290,30 @@ message SetPassword {
}
// Provide if the user needs to change the password on the next use.
bool change_required = 3;
// If neither, the current password nor a verification code generated by the PasswordReset is provided,
// the user must be granted permission to set a password.
oneof verification {
// Provide the current password to verify you're allowed to change the password.
string current_password = 4 [
(validate.rules).string = {min_len: 1, max_len: 200},
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1;
max_length: 200;
example: "\"Secr3tP4ssw0rd!\"";
}
];
// Or provider the verification code generated during password reset request.
string verification_code = 5 [
(validate.rules).string = {min_len: 1, max_len: 20},
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1;
max_length: 20;
example: "\"SKJd342k\"";
}
];
}
}
message SendPasswordResetEmail {

View File

@@ -1,8 +1,8 @@
syntax = "proto3";
package zitadel.user.v3alpha;
package zitadel.resources.user.v3alpha;
option go_package = "github.com/zitadel/zitadel/pkg/grpc/user/v3alpha";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/resources/user/v3alpha;user";
import "google/api/field_behavior.proto";
import "protoc-gen-openapiv2/options/annotations.proto";

View File

@@ -1,72 +1,71 @@
syntax = "proto3";
package zitadel.user.v3alpha;
package zitadel.resources.user.v3alpha;
option go_package = "github.com/zitadel/zitadel/pkg/grpc/user/v3alpha";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/resources/user/v3alpha;user";
import "google/api/field_behavior.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "validate/validate.proto";
import "zitadel/user/v3alpha/user.proto";
import "zitadel/object/v2/object.proto";
import "zitadel/resources/user/v3alpha/user.proto";
import "zitadel/resources/object/v3alpha/object.proto";
message SearchQuery {
oneof query {
message SearchFilter {
oneof Filter {
option (validate.required) = true;
// Union the results of each sub query ('OR').
OrQuery or_query = 1;
// Union the results of each sub filter ('OR').
OrFilter or_filter = 1;
// Limit the result to match all sub queries ('AND').
// Note that if you specify multiple queries, they will be implicitly used as andQueries.
// Use the andQuery in combination with orQuery and notQuery.
AndQuery and_query = 2;
// Use the andFilter in combination with orFilter and notFilter.
AndFilter and_filter = 2;
// Exclude / Negate the result of the sub query ('NOT').
NotQuery not_query = 3;
NotFilter not_filter = 3;
// Limit the result to a specific user ID.
UserIDQuery user_id_query = 4;
UserIDFilter user_id_filter = 4;
// Limit the result to a specific organization.
OrganizationIDQuery organization_id_query = 5;
OrganizationIDFilter organization_id_filter = 5;
// Limit the result to a specific username.
UsernameQuery username_query = 6;
UsernameFilter username_filter = 6;
// Limit the result to a specific contact email.
EmailQuery email_query = 7;
EmailFilter email_filter = 7;
// Limit the result to a specific contact phone.
PhoneQuery phone_query = 8;
PhoneFilter phone_filter = 8;
// Limit the result to a specific state of the user.
StateQuery state_query = 9;
StateFilter state_filter = 9;
// Limit the result to a specific schema ID.
SchemaIDQuery schema_ID_query = 10;
SchemaIDFilter schema_id_filter = 10;
// Limit the result to a specific schema type.
SchemaTypeQuery schema_type_query = 11;
SchemaTypeFilter schema_type_filter = 11;
}
}
message OrQuery {
repeated SearchQuery queries = 1 [
message OrFilter {
repeated SearchFilter queries = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "[{\"userIdQuery\": {\"id\": \"163840776835432705\",\"method\": \"TEXT_QUERY_METHOD_EQUALS\"}},{\"userIdQuery\": {\"id\": \"163840776835943483\",\"method\": \"TEXT_QUERY_METHOD_EQUALS\"}}]"
example: "[{\"userIdFilter\": {\"id\": \"163840776835432705\",\"method\": \"TEXT_FILTER_METHOD_EQUALS\"}},{\"userIdFilter\": {\"id\": \"163840776835943483\",\"method\": \"TEXT_FILTER_METHOD_EQUALS\"}}]"
}
];
}
message AndQuery {
repeated SearchQuery queries = 1 [
message AndFilter {
repeated SearchFilter queries = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "[{\"organizationIdQuery\": {\"id\": \"163840776835432705\",\"method\": \"TEXT_QUERY_METHOD_EQUALS\"}},{\"usernameQuery\": {\"username\": \"gigi\",\"method\": \"TEXT_QUERY_METHOD_EQUALS\"}}]"
example: "[{\"organizationIdFilter\": {\"id\": \"163840776835432705\",\"method\": \"TEXT_FILTER_METHOD_EQUALS\"}},{\"usernameFilter\": {\"username\": \"gigi\",\"method\": \"TEXT_FILTER_METHOD_EQUALS\"}}]"
}
];
}
message NotQuery {
SearchQuery query = 1 [
message NotFilter {
SearchFilter query = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"schemaIDQuery\": {\"id\": \"163840776835432705\"}}"
example: "{\"schemaIDFilter\": {\"id\": \"163840776835432705\"}}"
}
];
}
message UserIDQuery {
message UserIDFilter {
// Defines the ID of the user to query for.
string id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
@@ -78,12 +77,12 @@ message UserIDQuery {
}
];
// Defines which text comparison method used for the id query.
zitadel.object.v2.TextQueryMethod method = 2 [
zitadel.resources.object.v3alpha.TextFilterMethod method = 2 [
(validate.rules).enum.defined_only = true
];
}
message OrganizationIDQuery {
message OrganizationIDFilter {
// Defines the ID of the organization to query for.
string id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
@@ -95,12 +94,12 @@ message OrganizationIDQuery {
}
];
// Defines which text comparison method used for the id query.
zitadel.object.v2.TextQueryMethod method = 2 [
zitadel.resources.object.v3alpha.TextFilterMethod method = 2 [
(validate.rules).enum.defined_only = true
];
}
message UsernameQuery {
message UsernameFilter {
// Defines the username to query for.
string username = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
@@ -112,14 +111,14 @@ message UsernameQuery {
}
];
// Defines which text comparison method used for the username query.
zitadel.object.v2.TextQueryMethod method = 2 [
zitadel.resources.object.v3alpha.TextFilterMethod method = 2 [
(validate.rules).enum.defined_only = true
];
// Defines that the username must only be unique in the organisation.
bool is_organization_specific = 3;
}
message EmailQuery {
message EmailFilter {
// Defines the email of the user to query for.
string address = 1 [
(validate.rules).string = {max_len: 200},
@@ -131,12 +130,12 @@ message EmailQuery {
}
];
// Defines which text comparison method used for the email query.
zitadel.object.v2.TextQueryMethod method = 2 [
zitadel.resources.object.v3alpha.TextFilterMethod method = 2 [
(validate.rules).enum.defined_only = true
];
}
message PhoneQuery {
message PhoneFilter {
// Defines the phone of the user to query for.
string number = 1 [
(validate.rules).string = {min_len: 1, max_len: 20},
@@ -148,13 +147,13 @@ message PhoneQuery {
}
];
// Defines which text comparison method used for the phone query.
zitadel.object.v2.TextQueryMethod method = 2 [
zitadel.resources.object.v3alpha.TextFilterMethod method = 2 [
(validate.rules).enum.defined_only = true
];
}
message StateQuery {
message StateFilter {
// Defines the state to query for.
State state = 1 [
(validate.rules).enum.defined_only = true,
@@ -164,7 +163,7 @@ message StateQuery {
];
}
message SchemaIDQuery {
message SchemaIDFilter {
// Defines the ID of the schema to query for.
string id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
@@ -177,7 +176,7 @@ message SchemaIDQuery {
];
}
message SchemaTypeQuery {
message SchemaTypeFilter {
// Defines which type to query for.
string type = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
@@ -189,7 +188,7 @@ message SchemaTypeQuery {
}
];
// Defines which text comparison method used for the type query.
zitadel.object.v2.TextQueryMethod method = 2 [
zitadel.resources.object.v3alpha.TextFilterMethod method = 2 [
(validate.rules).enum.defined_only = true
];
}

View File

@@ -0,0 +1,112 @@
syntax = "proto3";
package zitadel.resources.user.v3alpha;
import "google/api/field_behavior.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "validate/validate.proto";
import "zitadel/resources/object/v3alpha/object.proto";
import "zitadel/resources/user/v3alpha/authenticator.proto";
import "zitadel/resources/user/v3alpha/communication.proto";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/resources/user/v3alpha;user";
message CreateUser {
// Define the schema the user's data schema by providing it's ID.
string schema_id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1,
max_length: 200,
example: "\"69629026806489455\"";
}
];
google.protobuf.Struct data = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"name\":\"Gigi\",\"description\":\"the giraffe\"}"
}
];
// Set the contact information (email, phone) for the user.
SetContact contact = 3;
// Set the initial authenticators of the user.
SetAuthenticators authenticators = 4;
// Optionally set a unique identifier of the user. If unset, ZITADEL will take care of it.
optional string user_id = 5 [
(validate.rules).string = {min_len: 1, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1,
max_length: 200,
example: "\"69629026806489455\"";
}
];
}
message PatchUser {
optional string schema_id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1,
max_length: 200,
example: "\"69629026806489455\"";
}
];
optional google.protobuf.Struct data = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"name\":\"Gigi\",\"description\":\"the giraffe\"}"
}
];
// Set the contact information (email, phone) for the user.
optional SetContact contact = 3;
// TODO: No SetAuthenticators?
}
message GetUser{
// Details provide some base information (such as the last change date) of the user.
zitadel.resources.object.v3alpha.Details details = 1;
// The schema the user and it's data is based on.
GetSchema schema = 2;
google.protobuf.Struct data = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"name\":\"Gigi\",\"description\":\"the giraffe\"}"
}
];
// Contact information for the user. ZITADEL will use this in case of internal notifications.
Contact contact = 4;
// The user's authenticators. They are used to identify and authenticate the user
// during the authentication process.
Authenticators authenticators = 5;
// State of the user.
State state = 6;
}
enum State {
USER_STATE_UNSPECIFIED = 0;
USER_STATE_ACTIVE = 1;
USER_STATE_INACTIVE = 2;
USER_STATE_DELETED = 3;
USER_STATE_LOCKED = 4;
}
message GetSchema {
// The unique identifier of the user schema.
string id = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629026806489455\""
}
];
// The human readable name of the user schema.
string type = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"employees\"";
}
];
// The revision the user's data is based on of the revision.
uint32 revision = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "7";
}
];
}

View File

@@ -1,25 +1,18 @@
syntax = "proto3";
package zitadel.user.schema.v3alpha;
package zitadel.resources.userschema.v3alpha;
import "google/api/field_behavior.proto";
import "google/protobuf/struct.proto";
import "validate/validate.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "zitadel/object/v2/object.proto";
import "zitadel/resources/object/v3alpha/object.proto";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/user/schema/v3alpha";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/resources/userschema/v3alpha;userschema";
message UserSchema {
// ID is the read-only unique identifier of the schema.
string id = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629012906488334\""
}
];
// Details provide some base information (such as the last change date) of the schema.
zitadel.object.v2.Details details = 2;
zitadel.resources.object.v3alpha.Details details = 2;
// Type is a human readable text describing the schema.
string type = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
@@ -60,55 +53,56 @@ enum FieldName {
FIELD_NAME_STATE = 2;
FIELD_NAME_REVISION = 3;
FIELD_NAME_CHANGE_DATE = 4;
FIELD_NAME_CREATION_DATE = 5;
}
message SearchQuery {
oneof query {
message SearchFilter {
oneof Filter {
option (validate.required) = true;
// Union the results of each sub query ('OR').
OrQuery or_query = 1;
// Union the results of each sub filter ('OR').
OrFilter or_filter = 1;
// Limit the result to match all sub queries ('AND').
// Note that if you specify multiple queries, they will be implicitly used as andQueries.
// Use the andQuery in combination with orQuery and notQuery.
AndQuery and_query = 2;
// Exclude / Negate the result of the sub query ('NOT').
NotQuery not_query = 3;
// Use the andFilter in combination with orFilter and notFilter.
AndFilter and_filter = 2;
// Exclude / Negate the result of the sub filter ('NOT').
NotFilter not_filter = 3;
// Limit the result to a specific schema type.
TypeQuery type_query = 5;
TypeFilter type_filter = 5;
// Limit the result to a specific state of the schema.
StateQuery state_query = 6;
StateFilter state_filter = 6;
// Limit the result to a specific schema ID.
IDQuery id_query = 7;
IDFilter id_filter = 7;
}
}
message OrQuery {
repeated SearchQuery queries = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "[{\"idQuery\": {\"id\": \"163840776835432705\",\"method\": \"TEXT_QUERY_METHOD_EQUALS\"}},{\"idQuery\": {\"id\": \"163840776835943483\",\"method\": \"TEXT_QUERY_METHOD_EQUALS\"}}]"
message OrFilter {
repeated SearchFilter queries = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "[{\"idFilter\": {\"id\": \"163840776835432705\",\"method\": \"TEXT_FILTER_METHOD_EQUALS\"}},{\"idFilter\": {\"id\": \"163840776835943483\",\"method\": \"TEXT_FILTER_METHOD_EQUALS\"}}]"
}
];
}
message AndQuery {
repeated SearchQuery queries = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "[{\"typeQuery\": {\"id\": \"employees\",\"method\": \"TEXT_QUERY_METHOD_STARTS_WITH\"}},{\"stateQuery\": {\"state\": \"STATE_ACTIVE\"}}]"
message AndFilter {
repeated SearchFilter queries = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "[{\"typeFilter\": {\"id\": \"employees\",\"method\": \"TEXT_FILTER_METHOD_STARTS_WITH\"}},{\"stateFilter\": {\"state\": \"STATE_ACTIVE\"}}]"
}
];
}
message NotQuery {
SearchQuery query = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"stateQuery\": {\"state\": \"STATE_ACTIVE\"}}"
message NotFilter {
SearchFilter filter = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"stateFilter\": {\"state\": \"STATE_ACTIVE\"}}"
}
];
}
message IDQuery {
// Defines the ID of the user schema to query for.
message IDFilter {
// Defines the ID of the user schema to filter for.
string id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(google.api.field_behavior) = REQUIRED,
@@ -118,14 +112,14 @@ message IDQuery {
example: "\"163840776835432705\"";
}
];
// Defines which text comparison method used for the id query.
zitadel.object.v2.TextQueryMethod method = 2 [
// Defines which text comparison method used for the id filter.
zitadel.resources.object.v3alpha.TextFilterMethod method = 2 [
(validate.rules).enum.defined_only = true
];
}
message TypeQuery {
// Defines which type to query for.
message TypeFilter {
// Defines which type to filter for.
string type = 1 [
(validate.rules).string = {max_len: 200},
(google.api.field_behavior) = REQUIRED,
@@ -134,14 +128,14 @@ message TypeQuery {
example: "\"employees\"";
}
];
// Defines which text comparison method used for the type query.
zitadel.object.v2.TextQueryMethod method = 2 [
// Defines which text comparison method used for the type filter.
zitadel.resources.object.v3alpha.TextFilterMethod method = 2 [
(validate.rules).enum.defined_only = true
];
}
message StateQuery {
// Defines the state to query for.
message StateFilter {
// Defines the state to filter for.
State state = 1 [
(validate.rules).enum.defined_only = true,
(google.api.field_behavior) = REQUIRED,

View File

@@ -1,6 +1,6 @@
syntax = "proto3";
package zitadel.user.schema.v3alpha;
package zitadel.resources.userschema.v3alpha;
import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
@@ -8,12 +8,12 @@ import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "validate/validate.proto";
import "zitadel/object/v2/object.proto";
import "zitadel/object/v3alpha/object.proto";
import "zitadel/resources/object/v3alpha/object.proto";
import "zitadel/protoc_gen_zitadel/v2/options.proto";
import "zitadel/user/schema/v3alpha/user_schema.proto";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/user/schema/v3alpha";
import "zitadel/resources/userschema/v3alpha/user_schema.proto";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/resources/userschema/v3alpha;userschema";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
@@ -103,12 +103,12 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
}
};
service UserSchemaService {
service ZITADELUserSchemas {
// List user schemas
// Search user schemas
//
// List all matching user schemas. By default, we will return all user schema of your instance. Make sure to include a limit and sorting for pagination.
rpc ListUserSchemas (ListUserSchemasRequest) returns (ListUserSchemasResponse) {
// Search all matching user schemas. By default, we will return all user schema of your instance. Make sure to include a limit and sorting for pagination.
rpc SearchUserSchemas (SearchUserSchemasRequest) returns (SearchUserSchemasResponse) {
option (google.api.http) = {
post: "/v3alpha/user_schemas/search"
body: "*"
@@ -124,13 +124,13 @@ service UserSchemaService {
responses: {
key: "200";
value: {
description: "A list of all user schema matching the query";
description: "A list of all user schema matching the search";
};
};
responses: {
key: "400";
value: {
description: "invalid list query";
description: "invalid search";
schema: {
json_schema: {
ref: "#/definitions/rpcStatus";
@@ -198,12 +198,12 @@ service UserSchemaService {
};
}
// Update a user schema
// Patch a user schema
//
// Update an existing user schema to a new revision. Users based on the current revision will not be affected until they are updated.
rpc UpdateUserSchema (UpdateUserSchemaRequest) returns (UpdateUserSchemaResponse) {
// Patch an existing user schema to a new revision. Users based on the current revision will not be affected until they are updated.
rpc PatchUserSchema (PatchUserSchemaRequest) returns (PatchUserSchemaResponse) {
option (google.api.http) = {
put: "/v3alpha/user_schemas/{id}"
patch: "/v3alpha/user_schemas/{id}"
body: "*"
};
@@ -297,26 +297,31 @@ service UserSchemaService {
}
message ListUserSchemasRequest {
// list limitations and ordering.
zitadel.object.v2.ListQuery query = 1;
// the field the result is sorted.
zitadel.user.schema.v3alpha.FieldName sorting_column = 2 [
message SearchUserSchemasRequest {
optional zitadel.object.v3alpha.Instance instance = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"FIELD_NAME_TYPE\"";
default: "\"domain from HOST or :authority header\""
}
];
// Define the criteria to query for.
repeated zitadel.user.schema.v3alpha.SearchQuery queries = 3;
// list limitations and ordering.
optional zitadel.resources.object.v3alpha.SearchQuery query = 2;
// The field the result is sorted by. The default is the creation date. Beware that if you change this, your result pagination might be inconsistent.
optional FieldName sorting_column = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
default: "\"TARGET_FIELD_NAME_CREATION_DATE\""
}
];
// Define the criteria to filter for.
repeated SearchFilter filters = 4;
}
message ListUserSchemasResponse {
message SearchUserSchemasResponse {
// Details provides information about the returned result including total amount found.
zitadel.object.v2.ListDetails details = 1;
zitadel.resources.object.v3alpha.ListDetails details = 1;
// States by which field the results are sorted.
zitadel.user.schema.v3alpha.FieldName sorting_column = 2;
FieldName sorting_column = 2;
// The result contains the user schemas, which matched the queries.
repeated zitadel.user.schema.v3alpha.UserSchema result = 3;
repeated UserSchema result = 3;
}
@@ -334,11 +339,29 @@ message GetUserSchemaByIDRequest {
}
message GetUserSchemaByIDResponse {
zitadel.user.schema.v3alpha.UserSchema schema = 1;
zitadel.resources.userschema.v3alpha.UserSchema schema = 1;
}
message CreateUserSchemaRequest {
optional zitadel.object.v3alpha.Instance instance = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
default: "\"domain from HOST or :authority header\""
}
];
CreateUserSchema user_schema = 2 [
(validate.rules).message = {
required: true
}
];
}
message CreateUserSchema{
optional zitadel.object.v3alpha.Instance instance = 4 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
default: "\"domain from HOST or :authority header\""
}
];
// Type is a human readable word describing the schema.
string type = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
@@ -373,14 +396,17 @@ message CreateUserSchemaRequest {
}
message CreateUserSchemaResponse {
// ID is the read-only unique identifier of the schema.
string id = 1;
// Details provide some base information (such as the last change date) of the schema.
zitadel.object.v2.Details details = 2;
zitadel.resources.object.v3alpha.Details details = 2;
}
message UpdateUserSchemaRequest {
message PatchUserSchemaRequest {
optional zitadel.object.v3alpha.Instance instance = 5 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
default: "\"domain from HOST or :authority header\""
}
];
// unique identifier of the schema.
string id = 1;
// Type is a human readable word describing the schema.
@@ -414,39 +440,75 @@ message UpdateUserSchemaRequest {
];
}
message UpdateUserSchemaResponse {
message PatchUserSchemaResponse {
// Details provide some base information (such as the last change date) of the schema.
zitadel.object.v2.Details details = 1;
zitadel.resources.object.v3alpha.Details details = 1;
}
message DeactivateUserSchemaRequest {
optional zitadel.object.v3alpha.Instance instance = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
default: "\"domain from HOST or :authority header\""
}
];
// unique identifier of the schema.
string id = 1;
string id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1,
max_length: 200,
example: "\"69629026806489455\"";
}
];
}
message DeactivateUserSchemaResponse {
// Details provide some base information (such as the last change date) of the schema.
zitadel.object.v2.Details details = 1;
zitadel.resources.object.v3alpha.Details details = 1;
}
message ReactivateUserSchemaRequest {
optional zitadel.object.v3alpha.Instance instance = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
default: "\"domain from HOST or :authority header\""
}
];
// unique identifier of the schema.
string id = 1;
string id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1,
max_length: 200,
example: "\"69629026806489455\"";
}
];
}
message ReactivateUserSchemaResponse {
// Details provide some base information (such as the last change date) of the schema.
zitadel.object.v2.Details details = 1;
zitadel.resources.object.v3alpha.Details details = 1;
}
message DeleteUserSchemaRequest {
optional zitadel.object.v3alpha.Instance instance = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
default: "\"domain from HOST or :authority header\""
}
];
// unique identifier of the schema.
string id = 1;
string id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1,
max_length: 200,
example: "\"69629026806489455\"";
}
];
}
message DeleteUserSchemaResponse {
// Details provide some base information (such as the last change date) of the schema.
zitadel.object.v2.Details details = 1;
zitadel.resources.object.v3alpha.Details details = 1;
}

View File

@@ -1,66 +0,0 @@
syntax = "proto3";
package zitadel.user.v3alpha;
import "google/api/field_behavior.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "validate/validate.proto";
import "zitadel/object/v2/object.proto";
import "zitadel/user/v3alpha/authenticator.proto";
import "zitadel/user/v3alpha/communication.proto";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/user/v3alpha";
message User {
// ID is the read-only unique identifier of the user.
string user_id = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629012906488334\"";
}
];
// Details provide some base information (such as the last change date) of the user.
zitadel.object.v2.Details details = 2;
// The user's authenticators. They are used to identify and authenticate the user
// during the authentication process.
Authenticators authenticators = 3;
// Contact information for the user. ZITADEL will use this in case of internal notifications.
Contact contact = 4;
// State of the user.
State state = 5;
// The schema the user and it's data is based on.
Schema schema = 6;
// The user's data based on the provided schema.
google.protobuf.Struct data = 7;
}
enum State {
USER_STATE_UNSPECIFIED = 0;
USER_STATE_ACTIVE = 1;
USER_STATE_INACTIVE = 2;
USER_STATE_DELETED = 3;
USER_STATE_LOCKED = 4;
}
message Schema {
// The unique identifier of the user schema.
string id = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629026806489455\""
}
];
// The human readable name of the user schema.
string type = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"employees\"";
}
];
// The revision the user's data is based on of the revision.
uint32 revision = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "7";
}
];
}