mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-14 18:05:12 +00:00
feat(group): group service to create, update, and delete groups (#10455)
# Which Problems Are Solved This PR adds API definition and backend implementation for GroupService to manage user groups. # How the Problems Are Solved * API definition to create, update, retrieve, and delete groups is added * Command-side implementation to create, update, and delete user groups as part of the GroupV2 API is added # Additional Changes N/A # Additional Context - Related to #10089, #9702 (parent ticket) - User contribution: https://github.com/zitadel/zitadel/pull/9428/files - Additional functionalities to list/search user groups, add permissions, manage users in groups, group scopes will be added in subsequent PRs. - Also needs documentation, which will be added once the entire feature is available --------- Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
co-authored by
Livio Spring
parent
ee3654fe6f
commit
b81dedcaea
@@ -29,6 +29,7 @@ import (
|
||||
authorization "github.com/zitadel/zitadel/pkg/grpc/authorization/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/feature/v2"
|
||||
feature_v2beta "github.com/zitadel/zitadel/pkg/grpc/feature/v2beta"
|
||||
group_v2 "github.com/zitadel/zitadel/pkg/grpc/group/v2"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/idp"
|
||||
idp_pb "github.com/zitadel/zitadel/pkg/grpc/idp/v2"
|
||||
instance "github.com/zitadel/zitadel/pkg/grpc/instance/v2beta"
|
||||
@@ -86,6 +87,7 @@ type Client struct {
|
||||
AppV2Beta app.AppServiceClient
|
||||
InternalPermissionv2Beta internal_permission_v2beta.InternalPermissionServiceClient
|
||||
AuthorizationV2Beta authorization.AuthorizationServiceClient
|
||||
GroupV2 group_v2.GroupServiceClient
|
||||
}
|
||||
|
||||
func NewDefaultClient(ctx context.Context) (*Client, error) {
|
||||
@@ -130,6 +132,7 @@ func newClient(ctx context.Context, target string) (*Client, error) {
|
||||
AppV2Beta: app.NewAppServiceClient(cc),
|
||||
InternalPermissionv2Beta: internal_permission_v2beta.NewInternalPermissionServiceClient(cc),
|
||||
AuthorizationV2Beta: authorization.NewAuthorizationServiceClient(cc),
|
||||
GroupV2: group_v2.NewGroupServiceClient(cc),
|
||||
}
|
||||
return client, client.pollHealth(ctx)
|
||||
}
|
||||
@@ -1285,3 +1288,20 @@ func (i *Instance) ActivateSchemaUser(ctx context.Context, orgID string, userID
|
||||
logging.OnError(err).Fatal("reactivate user")
|
||||
return user
|
||||
}
|
||||
|
||||
func (i *Instance) CreateGroup(ctx context.Context, t *testing.T, orgID, name string) *group_v2.CreateGroupResponse {
|
||||
resp, err := i.Client.GroupV2.CreateGroup(ctx, &group_v2.CreateGroupRequest{
|
||||
OrganizationId: orgID,
|
||||
Name: name,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
return resp
|
||||
}
|
||||
|
||||
func (i *Instance) DeleteGroup(ctx context.Context, t *testing.T, id string) *group_v2.DeleteGroupResponse {
|
||||
resp, err := i.Client.GroupV2.DeleteGroup(ctx, &group_v2.DeleteGroupRequest{
|
||||
Id: id,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
return resp
|
||||
}
|
||||
|
||||
@@ -91,3 +91,7 @@ func Slogan() string {
|
||||
func Number() int {
|
||||
return gofakeit.Number(0, 1_000_000)
|
||||
}
|
||||
|
||||
func GroupName() string {
|
||||
return "group_" + appName()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user