Files
zitadel/proto/zitadel/group/v2/group.proto
T
Gayathri VijayanandGitHub ad8e8bf61f feat(group): manage users in user groups (#10940)
# Which Problems Are Solved

1. Adding users to user groups and removing users from user groups.
2. Searching for users in user groups by group IDs or user IDs

# How the Problems Are Solved

By adding:
1. The API definitions to manage users in users groups
3. The command-layer implementation of adding users/removing users
to/from user groups.
4. The projection table group_users1
5. Query-side implementation to search for users in user groups

# Additional Changes

1. Remove debug statements from unit tests.
2. Fix removal of groups when orgs are removed
3. Add unit tests for groups projection

# Additional Context

* Related to #9702 
* Follow-up for PRs 
  * https://github.com/zitadel/zitadel/pull/10455
  * https://github.com/zitadel/zitadel/pull/10758
  * https://github.com/zitadel/zitadel/pull/10853
2025-10-28 13:23:54 +00:00

142 lines
3.9 KiB
Protocol Buffer

syntax = "proto3";
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "validate/validate.proto";
import "zitadel/filter/v2/filter.proto";
import "zitadel/authorization/v2beta/authorization.proto";
package zitadel.group.v2;
option go_package = "github.com/zitadel/zitadel/pkg/grpc/group/v2;group";
message Group {
// Unique identifier of the user group.
string id = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629023906488334\""
}
];
// Unique name of the user group inside the corresponding organization.
string name = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"Support Group\"";
}
];
// Description the user group.
string description = 3 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"Support Group\"";
}
];
// The ID of the organization to which the group belongs.
string organization_id = 4 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629098906488334\""
}
];
// Timestamp when the group was last changed.
google.protobuf.Timestamp change_date = 5 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"2025-01-23T10:34:18.051Z\"";
}
];
// Timestamp when the user group was created
google.protobuf.Timestamp creation_date = 6 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"2025-01-23T10:34:18.051Z\"";
}
];
}
message GroupUser {
// GroupID is the unique identifier of the user group.
string group_id = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629023906488334\""
}
];
// OrganizationID is the unique identifier of the organization to which the group belongs.
string organization_id = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629098906488334\""
}
];
// User represents the user in the user group.
zitadel.authorization.v2beta.User user = 3;
// CreationDate is the timestamp when the user was added to the group.
google.protobuf.Timestamp creation_date = 4 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"2025-01-23T10:34:18.051Z\"";
}
];
}
message GroupsSearchFilter {
oneof filter {
option (validate.required) = true;
// Search for groups by their IDs.
zitadel.filter.v2.InIDsFilter group_ids = 1;
// Search for groups by their names.
GroupNameFilter name_filter = 2;
// Search for groups by their organization ID.
zitadel.filter.v2.IDFilter organization_id = 3;
}
}
message GroupNameFilter {
// Name of the user group.
string name = 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: "\"My Group\"";
}
];
// Defines which text comparison method used for the name query.
zitadel.filter.v2.TextFilterMethod method = 2 [
(validate.rules).enum.defined_only = true,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "defines which text equality method is used";
}
];
}
enum FieldName {
FIELD_NAME_UNSPECIFIED = 0;
FIELD_NAME_ID = 1;
FIELD_NAME_NAME = 2;
FIELD_NAME_CREATION_DATE = 3;
FIELD_NAME_CHANGE_DATE = 4;
}
message GroupUsersSearchFilter {
oneof filter {
option (validate.required) = true;
// Search for groups by user IDs
zitadel.filter.v2.InIDsFilter user_ids = 1;
// Search for users in groups by group IDs
zitadel.filter.v2.InIDsFilter group_ids = 2;
}
}
enum GroupUserFieldName {
GROUP_USER_FIELD_NAME_UNSPECIFIED = 0;
GROUP_USER_FIELD_NAME_USER_ID = 1;
GROUP_USER_FIELD_NAME_GROUP_ID = 2;
GROUP_USER_FIELD_NAME_CREATION_DATE = 3;
}