mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-25 18:55:27 -06:00
Merge eb828842e5
into 7c96dcd9a2
This commit is contained in:
commit
76afec2d59
@ -93,8 +93,8 @@ func (s *Server) SetUpOrg(ctx context.Context, req *admin_pb.SetUpOrgRequest) (*
|
||||
return nil, err
|
||||
}
|
||||
var userID string
|
||||
if len(createdOrg.CreatedAdmins) == 1 {
|
||||
userID = createdOrg.CreatedAdmins[0].ID
|
||||
if len(createdOrg.OrgAdmins) == 1 {
|
||||
userID = createdOrg.OrgAdmins[0].GetID()
|
||||
}
|
||||
return &admin_pb.SetUpOrgResponse{
|
||||
Details: object.DomainToAddDetailsPb(createdOrg.ObjectDetails),
|
||||
|
@ -108,11 +108,15 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
},
|
||||
want: &org.AddOrganizationResponse{
|
||||
OrganizationId: integration.NotEmpty,
|
||||
CreatedAdmins: []*org.AddOrganizationResponse_CreatedAdmin{
|
||||
OrganizationAdmins: []*org.OrganizationAdmin{
|
||||
{
|
||||
UserId: userId,
|
||||
EmailCode: gu.Ptr(integration.NotEmpty),
|
||||
PhoneCode: nil,
|
||||
OrganizationAdmin: &org.OrganizationAdmin_CreatedAdmin{
|
||||
CreatedAdmin: &org.CreatedAdmin{
|
||||
UserId: userId,
|
||||
EmailCode: gu.Ptr(integration.NotEmpty),
|
||||
PhoneCode: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -152,10 +156,20 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &org.AddOrganizationResponse{
|
||||
CreatedAdmins: []*org.AddOrganizationResponse_CreatedAdmin{
|
||||
// a single admin is expected, because the first provided already exists
|
||||
OrganizationAdmins: []*org.OrganizationAdmin{
|
||||
{
|
||||
UserId: integration.NotEmpty,
|
||||
OrganizationAdmin: &org.OrganizationAdmin_AssignedAdmin{
|
||||
AssignedAdmin: &org.AssignedAdmin{
|
||||
UserId: User.GetUserId(),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
OrganizationAdmin: &org.OrganizationAdmin_CreatedAdmin{
|
||||
CreatedAdmin: &org.CreatedAdmin{
|
||||
UserId: integration.NotEmpty,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -181,16 +195,21 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
assert.Equal(t, got.GetDetails().GetResourceOwner(), got.GetOrganizationId())
|
||||
|
||||
// check the admins
|
||||
require.Len(t, got.GetCreatedAdmins(), len(tt.want.GetCreatedAdmins()))
|
||||
for i, admin := range tt.want.GetCreatedAdmins() {
|
||||
gotAdmin := got.GetCreatedAdmins()[i]
|
||||
assertCreatedAdmin(t, admin, gotAdmin)
|
||||
require.Len(t, got.GetOrganizationAdmins(), len(tt.want.GetOrganizationAdmins()))
|
||||
for i, admin := range tt.want.GetOrganizationAdmins() {
|
||||
gotAdmin := got.GetOrganizationAdmins()[i].OrganizationAdmin
|
||||
switch admin := admin.OrganizationAdmin.(type) {
|
||||
case *org.OrganizationAdmin_CreatedAdmin:
|
||||
assertCreatedAdmin(t, admin.CreatedAdmin, gotAdmin.(*org.OrganizationAdmin_CreatedAdmin).CreatedAdmin)
|
||||
case *org.OrganizationAdmin_AssignedAdmin:
|
||||
assert.Equal(t, admin.AssignedAdmin.GetUserId(), gotAdmin.(*org.OrganizationAdmin_AssignedAdmin).AssignedAdmin.GetUserId())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func assertCreatedAdmin(t *testing.T, expected, got *org.AddOrganizationResponse_CreatedAdmin) {
|
||||
func assertCreatedAdmin(t *testing.T, expected, got *org.CreatedAdmin) {
|
||||
if expected.GetUserId() != "" {
|
||||
assert.NotEmpty(t, got.GetUserId())
|
||||
} else {
|
||||
|
@ -68,17 +68,32 @@ func addOrganizationRequestAdminToCommand(admin *org.AddOrganizationRequest_Admi
|
||||
}
|
||||
|
||||
func createdOrganizationToPb(createdOrg *command.CreatedOrg) (_ *org.AddOrganizationResponse, err error) {
|
||||
admins := make([]*org.AddOrganizationResponse_CreatedAdmin, len(createdOrg.CreatedAdmins))
|
||||
for i, admin := range createdOrg.CreatedAdmins {
|
||||
admins[i] = &org.AddOrganizationResponse_CreatedAdmin{
|
||||
UserId: admin.ID,
|
||||
EmailCode: admin.EmailCode,
|
||||
PhoneCode: admin.PhoneCode,
|
||||
admins := make([]*org.OrganizationAdmin, len(createdOrg.OrgAdmins))
|
||||
for i, admin := range createdOrg.OrgAdmins {
|
||||
switch admin := admin.(type) {
|
||||
case *command.CreatedOrgAdmin:
|
||||
admins[i] = &org.OrganizationAdmin{
|
||||
OrganizationAdmin: &org.OrganizationAdmin_CreatedAdmin{
|
||||
CreatedAdmin: &org.CreatedAdmin{
|
||||
UserId: admin.ID,
|
||||
EmailCode: admin.EmailCode,
|
||||
PhoneCode: admin.PhoneCode,
|
||||
},
|
||||
},
|
||||
}
|
||||
case *command.AssignedOrgAdmin:
|
||||
admins[i] = &org.OrganizationAdmin{
|
||||
OrganizationAdmin: &org.OrganizationAdmin_AssignedAdmin{
|
||||
AssignedAdmin: &org.AssignedAdmin{
|
||||
UserId: admin.ID,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
return &org.AddOrganizationResponse{
|
||||
Details: object.DomainToDetailsPb(createdOrg.ObjectDetails),
|
||||
OrganizationId: createdOrg.ObjectDetails.ResourceOwner,
|
||||
CreatedAdmins: admins,
|
||||
Details: object.DomainToDetailsPb(createdOrg.ObjectDetails),
|
||||
OrganizationId: createdOrg.ObjectDetails.ResourceOwner,
|
||||
OrganizationAdmins: admins,
|
||||
}, nil
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ func Test_createdOrganizationToPb(t *testing.T) {
|
||||
EventDate: now,
|
||||
ResourceOwner: "orgID",
|
||||
},
|
||||
CreatedAdmins: []*command.CreatedOrgAdmin{
|
||||
{
|
||||
OrgAdmins: []command.OrgAdmin{
|
||||
&command.CreatedOrgAdmin{
|
||||
ID: "id",
|
||||
EmailCode: gu.Ptr("emailCode"),
|
||||
PhoneCode: gu.Ptr("phoneCode"),
|
||||
@ -151,11 +151,15 @@ func Test_createdOrganizationToPb(t *testing.T) {
|
||||
ResourceOwner: "orgID",
|
||||
},
|
||||
OrganizationId: "orgID",
|
||||
CreatedAdmins: []*org.AddOrganizationResponse_CreatedAdmin{
|
||||
OrganizationAdmins: []*org.OrganizationAdmin{
|
||||
{
|
||||
UserId: "id",
|
||||
EmailCode: gu.Ptr("emailCode"),
|
||||
PhoneCode: gu.Ptr("phoneCode"),
|
||||
OrganizationAdmin: &org.OrganizationAdmin_CreatedAdmin{
|
||||
CreatedAdmin: &org.CreatedAdmin{
|
||||
UserId: "id",
|
||||
EmailCode: gu.Ptr("emailCode"),
|
||||
PhoneCode: gu.Ptr("phoneCode"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -105,11 +105,15 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
},
|
||||
want: &org.AddOrganizationResponse{
|
||||
OrganizationId: integration.NotEmpty,
|
||||
CreatedAdmins: []*org.AddOrganizationResponse_CreatedAdmin{
|
||||
OrganizationAdmins: []*org.OrganizationAdmin{
|
||||
{
|
||||
UserId: integration.NotEmpty,
|
||||
EmailCode: gu.Ptr(integration.NotEmpty),
|
||||
PhoneCode: nil,
|
||||
OrganizationAdmin: &org.OrganizationAdmin_CreatedAdmin{
|
||||
CreatedAdmin: &org.CreatedAdmin{
|
||||
UserId: integration.NotEmpty,
|
||||
EmailCode: gu.Ptr(integration.NotEmpty),
|
||||
PhoneCode: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -149,10 +153,21 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: &org.AddOrganizationResponse{
|
||||
CreatedAdmins: []*org.AddOrganizationResponse_CreatedAdmin{
|
||||
// a single admin is expected, because the first provided already exists
|
||||
OrganizationId: integration.NotEmpty,
|
||||
OrganizationAdmins: []*org.OrganizationAdmin{
|
||||
{
|
||||
UserId: integration.NotEmpty,
|
||||
OrganizationAdmin: &org.OrganizationAdmin_AssignedAdmin{
|
||||
AssignedAdmin: &org.AssignedAdmin{
|
||||
UserId: User.GetUserId(),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
OrganizationAdmin: &org.OrganizationAdmin_CreatedAdmin{
|
||||
CreatedAdmin: &org.CreatedAdmin{
|
||||
UserId: integration.NotEmpty,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -178,16 +193,21 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
assert.Equal(t, got.GetDetails().GetResourceOwner(), got.GetOrganizationId())
|
||||
|
||||
// check the admins
|
||||
require.Len(t, got.GetCreatedAdmins(), len(tt.want.GetCreatedAdmins()))
|
||||
for i, admin := range tt.want.GetCreatedAdmins() {
|
||||
gotAdmin := got.GetCreatedAdmins()[i]
|
||||
assertCreatedAdmin(t, admin, gotAdmin)
|
||||
require.Len(t, got.GetOrganizationAdmins(), len(tt.want.GetOrganizationAdmins()))
|
||||
for i, admin := range tt.want.GetOrganizationAdmins() {
|
||||
gotAdmin := got.GetOrganizationAdmins()[i].OrganizationAdmin
|
||||
switch admin := admin.OrganizationAdmin.(type) {
|
||||
case *org.OrganizationAdmin_CreatedAdmin:
|
||||
assertCreatedAdmin(t, admin.CreatedAdmin, gotAdmin.(*org.OrganizationAdmin_CreatedAdmin).CreatedAdmin)
|
||||
case *org.OrganizationAdmin_AssignedAdmin:
|
||||
assert.Equal(t, admin.AssignedAdmin.GetUserId(), gotAdmin.(*org.OrganizationAdmin_AssignedAdmin).AssignedAdmin.GetUserId())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func assertCreatedAdmin(t *testing.T, expected, got *org.AddOrganizationResponse_CreatedAdmin) {
|
||||
func assertCreatedAdmin(t *testing.T, expected, got *org.CreatedAdmin) {
|
||||
if expected.GetUserId() != "" {
|
||||
assert.NotEmpty(t, got.GetUserId())
|
||||
} else {
|
||||
|
@ -67,17 +67,32 @@ func addOrganizationRequestAdminToCommand(admin *org.AddOrganizationRequest_Admi
|
||||
}
|
||||
|
||||
func createdOrganizationToPb(createdOrg *command.CreatedOrg) (_ *org.AddOrganizationResponse, err error) {
|
||||
admins := make([]*org.AddOrganizationResponse_CreatedAdmin, len(createdOrg.CreatedAdmins))
|
||||
for i, admin := range createdOrg.CreatedAdmins {
|
||||
admins[i] = &org.AddOrganizationResponse_CreatedAdmin{
|
||||
UserId: admin.ID,
|
||||
EmailCode: admin.EmailCode,
|
||||
PhoneCode: admin.PhoneCode,
|
||||
admins := make([]*org.OrganizationAdmin, len(createdOrg.OrgAdmins))
|
||||
for i, admin := range createdOrg.OrgAdmins {
|
||||
switch admin := admin.(type) {
|
||||
case *command.CreatedOrgAdmin:
|
||||
admins[i] = &org.OrganizationAdmin{
|
||||
OrganizationAdmin: &org.OrganizationAdmin_CreatedAdmin{
|
||||
CreatedAdmin: &org.CreatedAdmin{
|
||||
UserId: admin.ID,
|
||||
EmailCode: admin.EmailCode,
|
||||
PhoneCode: admin.PhoneCode,
|
||||
},
|
||||
},
|
||||
}
|
||||
case *command.AssignedOrgAdmin:
|
||||
admins[i] = &org.OrganizationAdmin{
|
||||
OrganizationAdmin: &org.OrganizationAdmin_AssignedAdmin{
|
||||
AssignedAdmin: &org.AssignedAdmin{
|
||||
UserId: admin.ID,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
return &org.AddOrganizationResponse{
|
||||
Details: object.DomainToDetailsPb(createdOrg.ObjectDetails),
|
||||
OrganizationId: createdOrg.ObjectDetails.ResourceOwner,
|
||||
CreatedAdmins: admins,
|
||||
Details: object.DomainToDetailsPb(createdOrg.ObjectDetails),
|
||||
OrganizationId: createdOrg.ObjectDetails.ResourceOwner,
|
||||
OrganizationAdmins: admins,
|
||||
}, nil
|
||||
}
|
||||
|
@ -136,8 +136,8 @@ func Test_createdOrganizationToPb(t *testing.T) {
|
||||
EventDate: now,
|
||||
ResourceOwner: "orgID",
|
||||
},
|
||||
CreatedAdmins: []*command.CreatedOrgAdmin{
|
||||
{
|
||||
OrgAdmins: []command.OrgAdmin{
|
||||
&command.CreatedOrgAdmin{
|
||||
ID: "id",
|
||||
EmailCode: gu.Ptr("emailCode"),
|
||||
PhoneCode: gu.Ptr("phoneCode"),
|
||||
@ -152,11 +152,15 @@ func Test_createdOrganizationToPb(t *testing.T) {
|
||||
ResourceOwner: "orgID",
|
||||
},
|
||||
OrganizationId: "orgID",
|
||||
CreatedAdmins: []*org.AddOrganizationResponse_CreatedAdmin{
|
||||
OrganizationAdmins: []*org.OrganizationAdmin{
|
||||
{
|
||||
UserId: "id",
|
||||
EmailCode: gu.Ptr("emailCode"),
|
||||
PhoneCode: gu.Ptr("phoneCode"),
|
||||
OrganizationAdmin: &org.OrganizationAdmin_CreatedAdmin{
|
||||
CreatedAdmin: &org.CreatedAdmin{
|
||||
UserId: "id",
|
||||
EmailCode: gu.Ptr("emailCode"),
|
||||
PhoneCode: gu.Ptr("phoneCode"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -267,7 +267,7 @@ func TestServer_CreateSession_lock_user(t *testing.T) {
|
||||
fmt.Sprintf("TestServer_CreateSession_lock_user_%s", gofakeit.AppName()),
|
||||
gofakeit.Email(),
|
||||
)
|
||||
userID := org.CreatedAdmins[0].GetUserId()
|
||||
userID := org.OrganizationAdmins[0].GetCreatedAdmin().GetUserId()
|
||||
Instance.SetUserPassword(IAMOwnerCTX, userID, integration.UserPassword, false)
|
||||
|
||||
// enable password lockout
|
||||
|
@ -267,7 +267,7 @@ func TestServer_CreateSession_lock_user(t *testing.T) {
|
||||
fmt.Sprintf("TestServer_CreateSession_lock_user_%s", gofakeit.AppName()),
|
||||
gofakeit.Email(),
|
||||
)
|
||||
userID := org.CreatedAdmins[0].GetUserId()
|
||||
userID := org.OrganizationAdmins[0].GetCreatedAdmin().GetUserId()
|
||||
Instance.SetUserPassword(IAMOwnerCTX, userID, integration.UserPassword, false)
|
||||
|
||||
// enable password lockout
|
||||
|
@ -185,7 +185,7 @@ func TestServer_GetUserByID(t *testing.T) {
|
||||
func TestServer_GetUserByID_Permission(t *testing.T) {
|
||||
newOrgOwnerEmail := gofakeit.Email()
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("GetHuman-%s", gofakeit.AppName()), newOrgOwnerEmail)
|
||||
newUserID := newOrg.CreatedAdmins[0].GetUserId()
|
||||
newUserID := newOrg.OrganizationAdmins[0].GetCreatedAdmin().GetUserId()
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.GetUserByIDRequest
|
||||
|
@ -1236,7 +1236,7 @@ func TestServer_UpdateHumanUser(t *testing.T) {
|
||||
func TestServer_UpdateHumanUser_Permission(t *testing.T) {
|
||||
newOrgOwnerEmail := gofakeit.Email()
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("UpdateHuman-%s", gofakeit.AppName()), newOrgOwnerEmail)
|
||||
newUserID := newOrg.CreatedAdmins[0].GetUserId()
|
||||
newUserID := newOrg.OrganizationAdmins[0].GetCreatedAdmin().GetUserId()
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.UpdateHumanUserRequest
|
||||
|
@ -195,7 +195,7 @@ func TestServer_GetUserByID_Permission(t *testing.T) {
|
||||
timeNow := time.Now().UTC()
|
||||
newOrgOwnerEmail := gofakeit.Email()
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("GetHuman-%s", gofakeit.AppName()), newOrgOwnerEmail)
|
||||
newUserID := newOrg.CreatedAdmins[0].GetUserId()
|
||||
newUserID := newOrg.OrganizationAdmins[0].GetCreatedAdmin().GetUserId()
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.GetUserByIDRequest
|
||||
|
@ -1190,7 +1190,7 @@ func TestServer_UpdateHumanUser(t *testing.T) {
|
||||
|
||||
func TestServer_UpdateHumanUser_Permission(t *testing.T) {
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("UpdateHuman-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
newUserID := newOrg.CreatedAdmins[0].GetUserId()
|
||||
newUserID := newOrg.OrganizationAdmins[0].GetCreatedAdmin().GetUserId()
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.UpdateHumanUserRequest
|
||||
|
@ -124,7 +124,7 @@ func Test_ZITADEL_API_missing_authentication(t *testing.T) {
|
||||
func Test_ZITADEL_API_missing_mfa_policy(t *testing.T) {
|
||||
clientID, _ := createClient(t, Instance)
|
||||
org := Instance.CreateOrganization(CTXIAM, fmt.Sprintf("ZITADEL_API_MISSING_MFA_%s", gofakeit.AppName()), gofakeit.Email())
|
||||
userID := org.CreatedAdmins[0].GetUserId()
|
||||
userID := org.OrganizationAdmins[0].GetCreatedAdmin().GetUserId()
|
||||
Instance.SetUserPassword(CTXIAM, userID, integration.UserPassword, false)
|
||||
authRequestID := createAuthRequest(t, Instance, clientID, redirectURI, oidc.ScopeOpenID, zitadelAudienceScope)
|
||||
sessionID, sessionToken, startTime, changeTime := Instance.CreatePasswordSession(t, CTXLOGIN, userID, integration.UserPassword)
|
||||
|
@ -50,10 +50,13 @@ type orgSetupCommands struct {
|
||||
pats []*PersonalAccessToken
|
||||
machineKeys []*MachineKey
|
||||
}
|
||||
|
||||
type CreatedOrg struct {
|
||||
ObjectDetails *domain.ObjectDetails
|
||||
CreatedAdmins []*CreatedOrgAdmin
|
||||
OrgAdmins []OrgAdmin
|
||||
}
|
||||
|
||||
type OrgAdmin interface {
|
||||
GetID() string
|
||||
}
|
||||
|
||||
type CreatedOrgAdmin struct {
|
||||
@ -64,6 +67,18 @@ type CreatedOrgAdmin struct {
|
||||
MachineKey *MachineKey
|
||||
}
|
||||
|
||||
func (a *CreatedOrgAdmin) GetID() string {
|
||||
return a.ID
|
||||
}
|
||||
|
||||
type AssignedOrgAdmin struct {
|
||||
ID string
|
||||
}
|
||||
|
||||
func (a *AssignedOrgAdmin) GetID() string {
|
||||
return a.ID
|
||||
}
|
||||
|
||||
func (c *Commands) setUpOrgWithIDs(ctx context.Context, o *OrgSetup, orgID string, allowInitialMail bool, userIDs ...string) (_ *CreatedOrg, err error) {
|
||||
cmds := c.newOrgSetupCommands(ctx, orgID, o)
|
||||
for _, admin := range o.Admins {
|
||||
@ -180,14 +195,15 @@ func (c *orgSetupCommands) push(ctx context.Context) (_ *CreatedOrg, err error)
|
||||
EventDate: events[len(events)-1].CreatedAt(),
|
||||
ResourceOwner: c.aggregate.ID,
|
||||
},
|
||||
CreatedAdmins: c.createdAdmins(),
|
||||
OrgAdmins: c.createdAdmins(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *orgSetupCommands) createdAdmins() []*CreatedOrgAdmin {
|
||||
users := make([]*CreatedOrgAdmin, 0, len(c.admins))
|
||||
func (c *orgSetupCommands) createdAdmins() []OrgAdmin {
|
||||
users := make([]OrgAdmin, 0, len(c.admins))
|
||||
for _, admin := range c.admins {
|
||||
if admin.ID != "" && admin.Human == nil {
|
||||
users = append(users, &AssignedOrgAdmin{ID: admin.ID})
|
||||
continue
|
||||
}
|
||||
if admin.Human != nil {
|
||||
|
@ -1515,8 +1515,8 @@ func TestCommandSide_SetUpOrg(t *testing.T) {
|
||||
ObjectDetails: &domain.ObjectDetails{
|
||||
ResourceOwner: "orgID",
|
||||
},
|
||||
CreatedAdmins: []*CreatedOrgAdmin{
|
||||
{
|
||||
OrgAdmins: []OrgAdmin{
|
||||
&CreatedOrgAdmin{
|
||||
ID: "userID",
|
||||
},
|
||||
},
|
||||
@ -1586,7 +1586,11 @@ func TestCommandSide_SetUpOrg(t *testing.T) {
|
||||
ObjectDetails: &domain.ObjectDetails{
|
||||
ResourceOwner: "orgID",
|
||||
},
|
||||
CreatedAdmins: []*CreatedOrgAdmin{},
|
||||
OrgAdmins: []OrgAdmin{
|
||||
&AssignedOrgAdmin{
|
||||
ID: "userID",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1696,8 +1700,8 @@ func TestCommandSide_SetUpOrg(t *testing.T) {
|
||||
ObjectDetails: &domain.ObjectDetails{
|
||||
ResourceOwner: "orgID",
|
||||
},
|
||||
CreatedAdmins: []*CreatedOrgAdmin{
|
||||
{
|
||||
OrgAdmins: []OrgAdmin{
|
||||
&CreatedOrgAdmin{
|
||||
ID: "userID",
|
||||
PAT: &PersonalAccessToken{
|
||||
ObjectRoot: models.ObjectRoot{
|
||||
|
@ -207,7 +207,25 @@ message AddOrganizationResponse{
|
||||
}
|
||||
zitadel.object.v2.Details details = 1;
|
||||
string organization_id = 2;
|
||||
// CreatedAdmin is now deprecated, use OrganizationAdmin instead
|
||||
repeated CreatedAdmin created_admins = 3;
|
||||
repeated OrganizationAdmin organization_admins = 4;
|
||||
}
|
||||
|
||||
message CreatedAdmin {
|
||||
string user_id = 1;
|
||||
optional string email_code = 2;
|
||||
optional string phone_code = 3;
|
||||
}
|
||||
message AssignedAdmin { string user_id = 1; }
|
||||
|
||||
message OrganizationAdmin {
|
||||
oneof OrganizationAdmin {
|
||||
option (validate.required) = true;
|
||||
|
||||
CreatedAdmin created_admin = 3;
|
||||
AssignedAdmin assigned_admin = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ListOrganizationsRequest {
|
||||
@ -224,3 +242,4 @@ message ListOrganizationsResponse {
|
||||
zitadel.org.v2.OrganizationFieldName sorting_column = 2;
|
||||
repeated zitadel.org.v2.Organization result = 3;
|
||||
}
|
||||
|
||||
|
@ -170,5 +170,23 @@ message AddOrganizationResponse{
|
||||
}
|
||||
zitadel.object.v2beta.Details details = 1;
|
||||
string organization_id = 2;
|
||||
// CreatedAdmin is now deprecated, use OrganizationAdmin instead
|
||||
repeated CreatedAdmin created_admins = 3;
|
||||
repeated OrganizationAdmin organization_admins = 4;
|
||||
}
|
||||
|
||||
message CreatedAdmin {
|
||||
string user_id = 1;
|
||||
optional string email_code = 2;
|
||||
optional string phone_code = 3;
|
||||
}
|
||||
message AssignedAdmin { string user_id = 1; }
|
||||
|
||||
message OrganizationAdmin {
|
||||
oneof OrganizationAdmin {
|
||||
option (validate.required) = true;
|
||||
|
||||
CreatedAdmin created_admin = 3;
|
||||
AssignedAdmin assigned_admin = 4;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user